Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Position is not a valid member of model?

Asked by 4 years ago

i was making a teleporter to another level and i got this message :

16:29:17.734 - Position is not a valid member of Model 16:29:17.734 - Stack Begin 16:29:17.735 - Script 'Workspace.Level1.TeleportStick.Part.TeleportScript', Line 3 - function teleportOnTouch 16:29:17.735 - Stack End

i was confused and until now, i still dont know the answer

the code :

function teleportOnTouch(partTouching)
    if partTouching.Parent:FindFirstChild("Humanoid") then
        partTouching.Parent.HumanoidRootPart.Position = workspace.Level2.TeleportStick.Position + Vector3.new(0, 5, 0)
    end
end

script.Parent.Touched:Connect(teleportOnTouch)
0
Check if teleportStick is not a model, models do not have position. imKirda 4491 — 4y

2 answers

Log in to vote
0
Answered by
Yozoh 146
4 years ago
partTouching.Parent.HumanoidRootPart.CFrame = CFrame.new(workspace.Level2.TeleportStick.Position + Vector3.new(0, 5, 0))

Try using CFrames

Ad
Log in to vote
0
Answered by 4 years ago

Change your code to this:

function teleportOnTouch(partTouching)
    if partTouching.Parent:FindFirstChild("Humanoid") then
        partTouching.Parent.HumanoidRootPart.CFrame = CFrame.new(workspace.Level2.TeleportStick.Position + Vector3.new(0, 5, 0))
    end
end

script.Parent.Touched:Connect(teleportOnTouch)

This basically changes where the player's humanoidrootpart is and "teleports" the humanoidrootpart which basically takes the whole player where the humanoidrootpart is

0
Thanks it worked! NakralMijal 0 — 4y
0
No worries! Please mark this as an answer! Lightning_Game27 232 — 4y

Answer this question