I want to display player money in ScreenGui without using leaderboard so I need some help!
Here is picture with my money system if I change it my other scripts broke
I have tried for like 5h and cant get it to worth
I want to display player money in ScreenGui without using leaderboard so I need some help!
Here is picture with my money system if I change it my other scripts broke
I have tried for like 5h and cant get it to worth
localscripts can’t access ServerStorage also you don’t seem to have a localscript
So i need to delete all my code and make new system?
no you need to use a localscript to change the label’s text to the Player’s money value
Change Money.Parent to
Money.Parent = Player
If I change to local script everything broke and I cant buy anything in game same with Money.Parent = Player if need i can send main script
So tell me is it like the leaderstats that you’re trying to make visible on a GUI, right?
Why put the money inside the Server Storage, when you can put it inside the player?
Make the leaderstats script like this:
game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
local Money = Instance.new("IntValue")
Money.Name = "Money"
Money.Value = --Put the value example: 100, 1000, 500, 50, 10
Money.Parent = leaderstats
end)
Please.
Use remote events.
Don’t put the value inside the leaderstats, this is because it’ll show the player’s money on the leadboard (That’s what he wants to do).
Make a Local Script and put this on the text inside the Gui.
wait() --give it time to load
local player = game.Players.LocalPlayer --gets the player
local money = player:FindFirstChild("Put Your Money Name Here")
local text = script.Parent
text.Text = money --or use "$"..money if you want to put a text on the start
money.Changed:Connect(function() --people keep asking me this but always use the changed function when doing this, this is so it wont lag the device
text.Text = money --or use "$"..money if you want to put a text on the start
end)
Local script can’t access Server Storage so you should add the money inside the player.
So I found a solution to this here it is;
local plr = game.Players.LocalPlayer
local money = plr:FindFirstChild("Money")
local gui = script.Parent
function updateText()
gui.Text = money.Value
end
updateText()
money:GetPropertyChangedSignal("Value"):Connect(updateText)
It should work.
If you’re doing this on Server side:
game.Players.PlayerAdded:Connect(function(Player)
local Money = Instance.new("IntValue")
Money.Name = Player.Name
Money.Value = 100
Money.Parent = Player -- Change to whatever
Player.PlayerGui.ScreenGui.Amount.Value = Player.Money.Value
Player.Money.Changed:Connect(function() -- Synchronizing when their cash changes
Player.PlayerGui.ScreenGui.Amount = Player.Money.Value
end)
end)
I don’t think showing a player’s money server-side is needed. But still got some examples though!