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

gui button clicked to teleport player. does not work?

** SERVER SCRIPT IN TEXTBUTTON local Spawns = game.workspace.Map.Spawns.Spawn spawn part

function Click() function script.Parent.Parent.Parent.Parent.Parent.Parent.Character.Torso.CFrame = Spawns.CFrame teleport player end

script.Parent.MouseButton1Down:connect(Click)** when he clicks whats wrong with the script i mean i don't see anything wrong any help? Thank you.

1 comment

0

Probably the too many Parents in your fourth line, please provide errors with your questions if any are available.

1 answer

If you want it to 'clicked on gui' then You must use local script! Unless you would want the player to click on the brick then use your script with a 'ClickDetector' near 'script.Parent' at line #8 then replace 'MouseButton1Down' to MouseClick. Local Script:

 local player = game.Players.LocalPlayer
    local spawns = workspace.Map.Spawns.Spawn
    
    function Click()
    player.Character.Torso.CFrame = spawns.CFrame
    end
    
    script.Parent.MouseButton1Down:Connect(Click) -- The textbutton

Hope this helps!

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