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

How do you make a click to respawn button in roblox studio?

I was recently making a Roblox game called "The nutcracker". in Roblox, The only problem is when I was making a death screen I already know how to make a "Back to lobby" button,

local TeleportService = game:GetService("TeleportService")

local Place = Place id here

local player = game.Players.LocalPlayer

script.Parent.MouseButton1Click:connect(function()

TeleportService:Teleport(Place, player)

end)

But the problem is I don't know how to make a respawn button. Please Help!

Many Thanks, Cyber_gamer91 Game link here! https://web.roblox.com/games/4451993957/The-Nutcracker

1 comment

0

LoadCharacter (respawn argument) can only be called from server. This means you'd have to fire a remote event when you click the 'respawn' button on the client.

3 answers

✓ Accepted answer

You need to make a ScreenGui and insert a text button. Add a script and use the following code:

function m1down()
	script.Parent.Parent.Parent.Parent:LoadCharacter()
end

script.Parent.MouseButton1Down:connect(m1down)

If you want to know how to load the gui when the player dies, let me know

2 comments

0

Thanks! I already know how to make the gui load when player dies, but thanks a lot iiPizzaCraver! Want to friend me on roblox? :D I appreciate you showed me I copied the script and it WORKS!!! Thanks so much! :)

0

No worries, i can't friend at the moment but no problem :)

Make a Text Button in a Screen GUI and put this inside a local script inside the Text Button:

script.Parent.MouseButton1Click:Connect(function(player)
      local char = game.Players.LocalPlayer
      char:LoadCharacter()
end)

If this helped please accept this answer.

UI should not be touched by the server. Use FireServer() instead.

Learn more about remotes here.

1 comment

0

HMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM

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