teleportpositon = CFrame.new(241.999, 43,607, 318) script.Parent.ClickDetector.MouseClick:Connect(function(player) wait (5) script.Parent.Parent.Model.PART1.CanCollide = true script.Parent.Parent.Model.Part.CanCollide = true print ("elevator going up") if game.Workspace[player.Name]:FindFirstChild("Humanoid") then playerWhoClicked.parent.HumanoidRootPart.CFrame = teleportpositon end end)
I would like to make an elevator but it won't work can you help?
Mistake 1: You passed the player through the function, but used a different variable to reference the player. On line 2, the variable is called "Player", but on line 8, you use "PlayerWhoClicked"
Mistake 2: You tried finding the HumanoidRootPart in the PlayerFolder on line 8. A ClickDetector passes the Player in the PlayerFolder. You tried finding the parent of said player.
local teleportpositon = 241.999, 43,607, 318 script.Parent.ClickDetector.MouseClick:Connect(function(playerWhoClicked) wait (5) script.Parent.Parent.Model.PART1.CanCollide = true script.Parent.Parent.Model.Part.CanCollide = true print ("elevator going up") if playerWhoClicked.Character:FindFirstChild("Humanoid") then playerWhoClicked.Character:MoveTo(Vector3.new(teleportpositon)) end end)
I think nothings happening because of the weird CFrame at the top.
I think you accidentally put a , instead of a . when making the CFrame.
I think you could just change it to
CFrame.new(242, 43.5, 318)
and it would work.