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

What I'm doing wroung?

spawn = game.Workspace.SpawnLocation player = script.Parent.Parent.Parent.Parent

function onClicked() player.Character:MoveTo (spawn.Postion) end

script.Parent.MouseButton1Down:connect (onClicked)

I'm trying to make a teleport back to spawn but I'm confused that it wouldn't click. Is there another script that I need to use. Like two scripts or local script or just ClickDetector?

1 answer

You din't define what player is. You would have to define player.

--For local-scripts
local Player = game.Players.LocalPlayer
--For Server-scripts
local Player = script.Parent.Parent until the Parent is a Player.

3 comments

0

It's not really clear to me of what your saying

0

Well, You din't define player in your script, So when it tries to use player it would error and not work, So in my script it tells you how to define player for a localscript or regular script. These versions only work for scripts inside of PlayerGui or Backpack though. I assumed your script is in one of those two since you din't use a ClickDetector?

0

I'm am also have problem where the TextButton wont work

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