So I want the player to be able to click a ScreenGui's TextButton and respawn the player without actually killing them
local name = game.Players.LocalPlayer --Get their name. TextButton.MouseButton1Click:connect(function() if game.Players:FindFirstChild(name) then --Is there a player with that name? game.Players:FindFirstChild(name):LoadCharacter() end end)
This is confusing me, i've been looking at sources the past literal 3 hours watching the RT podcast on my other monitor, and I cannot figure this out, I've looked all around and altered this and many others scripts.
This is how it's ordered if it helps | StarterGui ScreenGui TextButton LocalScript
Try:
local player = game.Players.LocalPlayer script.Parent.MouseButton1Click:connect(function() player:LoadCharacter() end)
Simple as that.
Put this in a LocalScript and you're good
local Player=game.Players.LocalPlayer TextButton.MouseButton1Click:connect(function() Player:LoadCharacter() end)
Or...
local Player = script.Parent.Parent.Parent script.Parent.MouseButton1Click:connect(function() Player:LoadCharacter() end)
Try this with a regular Script, because it didn't work for me with a LocalScript.
...It's so weird though, because
http://wiki.roblox.com/index.php?title=API:Class/Player/LoadCharacter
told me otherwise.