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

I want the person that clicks the GUI to respawn, but it doesn't work??

Asked by 8 years ago
script.Parent.MouseButton1Click(function(player)
    player:LoadCharacter()
end)

1 answer

Log in to vote
1
Answered by 8 years ago
Edited 8 years ago

The even MouseButton1Click does NOT give you the player who actually touched the button. Oh, and you also forgot to add :connect.

If the script is a localscript inside of a gui, replace that with this:

local Player=game:GetService("Players").LocalPlayer
script.Parent.MouseButton1Click:connect(function()
    Player:LoadCharacter()
end)

If that does not work, put true inside of the parentheses of :LoadCharacter

Ad

Answer this question