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

How to make a TextBox's text remain the same after respawn?

Asked by 5 years ago

Every time a player respawns, the textbox's text that shows how much money they have returns to 0 (the default text i set in the textbox properties) until it modifies. Is there any way to make it stay the same? So far I've tried:

player.CharacterAdded:Connect(function(character) 
    character:WaitForChild("Humanoid").Died:Connect(function()
        script.Parent.MainGui.CashBox:WaitForChild("Cash")      
        upreq:FireServer(player)
    end)
end)

Cash is the textbox, and upreq is an event tied to a script inside serverscriptservice:

local function UpdateCash(player, amount)
    UpdEve:FireClient(player, amount)
end

local function UpdateRqst(player)
    UpdateCash(player, PlayerSesStats[player.UserId].Money)
end

updrq.OnServerEvent:Connect(UpdateRqst)

1 answer

Log in to vote
1
Answered by
mattscy 3725 Moderation Voter Community Moderator
5 years ago

There is a property of ScreenGuis called ResetOnSpawn. If you set this to false, all the contents of the screen gui will not be altered on death.

0
Thank you! radusavin366 617 — 5y
Ad

Answer this question