I have finally created a TextButton GUI on the edge of the screen (So happy about it too :P), and put in a script that would cause teleportation on click. However, it is not working.
Here is the code I am using.
bin = script.Parent
function onClick()
if Part.Parent:FindFirstChild("Torso") then
Part.Parent.Torso.CFrame = CFrame.new(Vector3.new(84, 160, 12))
end
end
bin.MouseButton1Click:connect(onClick)
I suspect it has something to do with the variable or the function. If you could, may you put comment snippets in the code to show where you changed something?
Thank you in advance.
Edit: Also, where should I put the script? I have a ScreenGUI, which is a parent to TextButton, which the script is in. Is this correct?

3 comments
I'm edited to code to show the changes, and I'm clicking the GUI, but it is not teleporting me. I'm looking through the code again to see if I copied something wrong.
Nevermind! It worked. Thank you!
No problem!