#changing player position before they load in

25 messages · Page 1 of 1 (latest)

willow cape
#
local function moveTo(player, part)
    wait()
    local forest = part
    local x = forest.Position.X + math.random(-forest.Size.X/2,forest.Size.X/2)
    local y = forest.Position.Y + math.random(-forest.Size.Y/2,forest.Size.Y/2)
    local z = forest.Position.Z + math.random(-forest.Size.Z/2,forest.Size.Z/2)
    local hum = player:WaitForChild("Humanoid")
    if hum then
        player.Character:SetPrimaryPartCFrame(CFrame.new(x,y,z) + Vector3.new(0,5,0))
    end
    
end

for some reason, im getting the error code Character is not a valid member of Model "Workspace.Player2". im pretty sure its because its checking before the player loads in, but i dont know how to implement it

turbid copper
#

@willow cape

#

u still there?

willow cape
#

yes

turbid copper
#

$15 bucks and i give u the answer

#

nah im jk

willow cape
#

ok thank god

turbid copper
#

so what is happening is

#

in that function u made, the parameter "player" is already the character

#

and in this line

#
    if hum then
        player.Character:SetPrimaryPartCFrame(CFrame.new(x,y,z) + Vector3.new(0,5,0))
    end
willow cape
#

mhm

turbid copper
#

ur tryna get the character of the character

#

which dont make sense

willow cape
#

ohhh

turbid copper
#

just remove the

#

.Character

#

do

willow cape
#

kk

turbid copper
#
    if hum then
        player:SetPrimaryPartCFrame(CFrame.new(x,y,z) + Vector3.new(0,5,0))
    end
    
#

see if it works

willow cape
#

ill test it rn

#

omg

#

it works now

#

tysm