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

Once the player dies, the currency will add up for for one second it resets back to 0?

Asked by 2 years ago

I am trying to make it where if the player dies, the currency amount will go + 1 as stated in the title. But the problem is, after the humanoid dies, the currency DOES go up 1 but for only a second and resets back to its normal. If that makes more clear. Full code is listed below.

local Player = game:GetService("Players").LocalPlayer
local Character = Player.Character
local TweenService = game:GetService("TweenService")

local CurrencyUI = Player.PlayerGui:WaitForChild("Currency")
local MoneySign = CurrencyUI.Frame:WaitForChild("MoneySign")
local Amount = CurrencyUI.Frame:WaitForChild("Amount")

repeat 
    wait()
    Character = Player.Character
until Character ~= nil

local Humanoid = Character:WaitForChild("Humanoid")

Humanoid.Died:Connect(function()
    Amount.Text += 1
end)
0
There is no data store in the game yet Experol 5 — 2y

1 answer

Log in to vote
0
Answered by
mikurx 15
2 years ago

Disable the GUI's 'ResetOnSpawn' property

Ad

Answer this question