Yup, it is not, i have some script for showing the mony that you got (In the screen, not the leaderboard) first it were good but later it said "leaderstats is not a valid member of Player"
Here's the script..
local Coins = script.Parent.Parent.Parent.Parent.leaderstats.Coins Coins.Changed:Connect(function() script.Parent.Text = "$: "..Coins.Value end)
can somene help?
You should use a local script in your TextLabel in your Screen Gui Instead of a regular script and trying to find the player from the PlayerGui.
The code in the local script should go something like this:
local plr = game.Players.LocalPlayer local Coins = plr:WaitForChild("leaderstats"):WaitForChild("Coins") local CoinsText = script.Parent Coins:GetPropertyChangedSignal("Value"):Connect(function() CoinsText.Text = "$: "..Coins.Value end)
Firstly, using the whole "script.Parent.Parent.Parent.Parent" method gets the player's Character
, not the Player
itself.
Secondly, you are edit anything related to GUI
's via a ServerScript
. Try using a LocalScript instead.
Thirdy, :Changed()
is not an Instance
to my knowledge. You'd have to use :GetPropertyChangedSignal
instance instead.
Anyways, here's your fixed code (make sure to put it into a LocalScript
)
local player = game.Players.LocalPlayer local coins = player:WaitForChild('leaderstats').Coins coins:GetPropertyChangedSignal('Value'):Connect(function() script.Parent.Text = '$ ' ..coins.Value.. '.'
Please let me know if it works or not after you apply my code to your game.
Try this with a server script:
Assuming you have a ScreenGui named MoneyDisplay with a TextLabel, insert the following into ServerScriptService:
game.Players.PlayerAdded:Connect(function(player) -- Assuming you have the leaderstats set up local Coins = player:WaitForChild("leaderstats").Coins Coins.Changed:Connect(function() player.PlayerGui.MoneyDisplay.TextLabel.Text = "$"..(Coins.Value) end) end)
Try:
Player:WaitForChild("Leaderstats")