How would I update this script so it actually displays how many diamonds the player will receive and display the timer for when the player will receive the diamond?
I’ve been trying to find a way but it wont work lol.
How would I update this script so it actually displays how many diamonds the player will receive and display the timer for when the player will receive the diamond?
I’ve been trying to find a way but it wont work lol.
the diamond text label is inside StarterGui instead of PlayerGui, that is why it is not displaying anything.
local player=game.Players.LocalPlayer
local leaderstats = player:WaitForChild("leaderstats")
local Diamonds=Instance.new("NumberValue", leaderstats)
Diamonds.Name = "Diamonds"
Diamonds.Value = 0
local diamondIncrement = 1
local StarterGui=player:WaitForChild("PlayerGui")
local DiamondTextLabel=StarterGui.PlayerStats.DiamondTextLabel
while true do
wait(5)
Diamonds.Value += diamondIncrement
DiamondTextLabel.Text = "Next diamond: "..diamondIncrement
diamondIncrement += 1
end
hope this helps
That doesn’t seem to be working.
ah, can you explain whats happening?
Does your GUI have ResetOnSpawn enabled, and where is this script located? There could be possible conflicts. Is this a LocalScript too?
Resetonspawn is enabled and the local script is located in Starterplayerscripts.
@NotToastehNew is correct about the PlayerGui, but the timer hasn’t even been implemented. Here’s what you can do for the timer:
while true do
for i = 5, 1, -1 do -- count from 5 to 1
DiamondTextLabel.Text = "Next diamond: "..i -- display timer
task.wait(1) -- waits 1 second (x5)
end
Diamonds.Value += diamondIncrement
diamondIncrement += 1
end
You need to disable this as the TextLabel gets deleted upon respawn.
Another thing, you might want to create the diamonds leaderstat on the server for server scripts to be able to access it.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.