If I already have the death screen GUI set up, how would I script it so it pops up when you die and you have to hit a button to respawn?
No random title selection just a respawn button and a death screen popup.
Thanks,
YT
If I already have the death screen GUI set up, how would I script it so it pops up when you die and you have to hit a button to respawn?
No random title selection just a respawn button and a death screen popup.
Thanks,
YT
Turn off player.CharacterAutoLoads first
Then do
humanoid.Died:Connect(function())
gui pops up
end)
button clicked connect
player:LoadCharacter()
end)
You would need:
humanoid.Died:Connect(function() -- You did (function()) (Not sure if thats correct)
gui comes up
end)
then,
script.Parent.MouseButton1down:Connect(function()
player:LoadCharacter()
-- Gui goes off
end)
Once you get to then, (Line 4) there is an error. Any help on that?
What’s the error and what’s the code you wrote that throws that error?
Do NOT do Function()), you gotta do function()
I did. There is an error at line 4
At the
script.Parent.MouseButton1Down:Connect(function()
?
edit: It is MouseButton1Down I did not capitalize Down.
I fixed that but there is still an error on line four.
If I were to write the script I would do this:
humanoid.Died:Connect(function()
script.Parent.Frame.Visible = true --Where ever your frame is.
end)
wait(3)
script.Parent.MouseButton1down:Connect(function()
player:LoadCharacter()
script.Parent.Frame.Visible = false -- Gui goes off
end)
I tested that but, it didn’t work. Idk why.
01:33:56.006 - Players.YT_Gamer1212.PlayerGui.DeathScreen.Frame.Button.LocalScript:1: attempt to index nil with ‘Died’ That is the error I get.
I will test it myself, make sure your layout would be something like this:
game>StarterGui>ScreenGui>Script+frame
You will have to define humanoid
PlayerInstance:LoadCharacter() is server-sided, UI should be handled by the client.
Hence: LoadCharacter will not work in a localscript.
Using a script would work instead of local?
Server scripts is not made to handle UI-related stuff.
Use a :FireServer() instead.
So in all if I were to write that script out what would it look like?
It’s wiser to use Activated
than MouseButton1down
.
Is Activated
Clicked OR down?