I'm trying to make a script that teleports someone who clicks a button, but it never works in game it only works in studio. What did I do wrong?
function onClicked(playerWhoClicked)
hum = game.Players.LocalPlayer.Character
hum.Torso.CFrame = CFrame.new(script.Parent.Parent.Teleport.Position)
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)

7 comments
Is this in a local script or a server script?
It's a server script.
Since you Used LocalPlayer for your "hum" Variable, you will need to try it in a local script since LocalPlayer is used in Local Scripts.. Im not sure if it will work, but see if it will
It doesn't work. Is the problem the LocalPlayer? I wasn't sure how else to find the player who clicked it.
Look, I gtg so I cant really help you right now, but Local scripts do not work in Workspace, and I believe your problem is using Local Player, so you will need probably need to access the player another way, I will be back on tomorrow to see if you figured it out, then I can help then..
Okay, I'll try and figure it out
I edited my question.