Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 4 years ago
Edited 4 years ago

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

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. big_thonk 0 — 4y

3 answers

Log in to vote
0
Answered by 4 years ago

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

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! :) Cyber_gamer91 -3 — 4y
0
No worries, i can't friend at the moment but no problem :) iiPizzaCraver 71 — 4y
Ad
Log in to vote
0
Answered by 4 years ago

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.

Log in to vote
0
Answered by
Syclya 224 Moderation Voter
4 years ago

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

Learn more about remotes here.

0
HMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM Cyber_gamer91 -3 — 4y

Answer this question