Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Position is not a valid member of model?

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)

1 comment

0

Check if teleportStick is not a model, models do not have position.

2 answers

partTouching.Parent.HumanoidRootPart.CFrame = CFrame.new(workspace.Level2.TeleportStick.Position + Vector3.new(0, 5, 0))

Try using CFrames

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

2 comments

0

Thanks it worked!

0

No worries! Please mark this as an answer!

This discussion is preserved as it was. New answers, comments, and votes are closed.