clone variable results to undefined but the base model results fine

// prev code here
// oh yeah Players is a variable on the original script
for (const [index, Player] of ipairs(Players))
{
const PlayerZoneID = `Player${index}`
const PlayerZone = PlayerZones.FindFirstChild(PlayerZoneID) as BasePart

const PlayerCharacter = (Player.Character || Player.CharacterAdded.Wait()) as Model

if (!PlayerCharacter) return;
if (!PlayerZone) return

print(PlayerCharacter)
print(PlayerFolder)

const PlayerCharacterClone = PlayerCharacter.Clone() // can this mf stop resulting to undefined

if (PlayerCharacterClone) {
PlayerCharacterClone.Parent = Workspace

const RotationCFrame = LookAtOrigin(PlayerZone.Position, Origin.Position)
PlayerCharacterClone.PivotTo(RotationCFrame)
}
}
// prev code here
// oh yeah Players is a variable on the original script
for (const [index, Player] of ipairs(Players))
{
const PlayerZoneID = `Player${index}`
const PlayerZone = PlayerZones.FindFirstChild(PlayerZoneID) as BasePart

const PlayerCharacter = (Player.Character || Player.CharacterAdded.Wait()) as Model

if (!PlayerCharacter) return;
if (!PlayerZone) return

print(PlayerCharacter)
print(PlayerFolder)

const PlayerCharacterClone = PlayerCharacter.Clone() // can this mf stop resulting to undefined

if (PlayerCharacterClone) {
PlayerCharacterClone.Parent = Workspace

const RotationCFrame = LookAtOrigin(PlayerZone.Position, Origin.Position)
PlayerCharacterClone.PivotTo(RotationCFrame)
}
}
Solution:
Message Not Public
Sign In & Join Server To View
Jump to solution
1 Reply
Unknown User
Unknown User2mo ago
Message Not Public
Sign In & Join Server To View

Did you find this page helpful?