I get coins when I do a certain thing and they display on the leaderboard, but there is also a text that shows your coins on your screen. It is supposed to show "Cash: 1" when you get one coin but it doesn't work
Script:
while true do
wait()
game.StarterGui.CoinsGui.CoinsLabel.Text = "Coins: " .. game.Players.LocalPlayer.leaderstats.Coins.Value
end
#.
32 messages · Page 1 of 1 (latest)
- Is it a server script?
local
Where is it located?
Players - player scripts
so u just wanna display on a text label how many coins someone has?
Ik its because you’re using game.startergui
wdym
Put it inside the text label that should display
In startergui
I got this 👍
No
I tried changing it to "player scripts" but forgot to change the game.StarterGui
You’ve gotta change it too
Put the script inside the label and paste this:
while true do
task.wait()
script.Parent.Text = "Coins: "..game.Players.LocalPlayer.leaderstats.coins.Value
end
still no, should I send my leaderstats script?
** You are now Level 2! **
Yes
game.Players.PlayerAdded:Connect(function(player )
local leaderstats = Instance.new("Folder", player)
leaderstats.Name = "leaderstats"
local coins = Instance.new("IntValue", leaderstats)
coins.Name = "coins"
coins.Value = 100
end)
the script is inside ServerScriptService
Edited it, try now
YooO ooo ooiOADOSa odosAODO asdIAIT workss tysm man
Np
use .Changed event
local player = game:GetService("Players").LocalPlayer
local Coins: StringValue = player:WaitForChild("leaderstats"):WaitForChild("coins")
script.Parent.Text = "Coins: " .. Coins.Value
Coins.Changed:Connect(function()
script.Parent.Text = "Coins: " .. Coins.Value
end)
or :GetPropertyChangedSignal
Yo! You hot s1? Congrats!