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

Check for character respawn?

Asked by 9 years ago

Is there a way to make a script constantly check to see if a player has respawned?

local player = game.Players.LocalPlayer
local role = player:WaitForChild("Role")

local frame = player.PlayerGui.HUD:WaitForChild("SpectatePrompt")

local replicatedstorage = game:GetService("ReplicatedStorage")
local event = replicatedstorage:WaitForChild("RemoteEvent")

local statustag = replicatedstorage:WaitForChild("StatusTag")
local timertag = replicatedstorage:WaitForChild("TimerTag")

local button = frame:WaitForChild("SpectateButton")

role.Changed:connect(function(playerrole)
    if statustag.Value ~= "Match" then
        button.Visible = false
    elseif statustag.Value == "Match" then
        if playerrole.Value ~= "" then
            button.Visible = false
        elseif playerrole.Value == "" then
            button.Visible = true           
        end
    end
end)

I have this script which I want to check and wait if a player has respawned, cause it doesn't make the gui visible when they have died. Please help

Answer this question