This script tries to update a GUI so it shows the correct amount of money in your wallet. However, it pulls out this error:
Variables is not a valid member of PlayerScripts
Here's how the player looks when you spawn. https://i.gyazo.com/762eb98620557f8ace39012bd6e55833.png
Now here's the code for the previously mentioned GUI.
--Excuse the inefficiency with the two functions function changed() script.Parent.Text = "Wallet: " ..script.Parent.Parent.Parent.Parent.Parent.PlayerScripts.Variables.Gold.Value.. "/" ..script.Parent.Parent.Parent.Parent.Parent.PlayerScripts.Variables.MaxGold.Value end script.Parent.Parent.Parent.Parent.Parent.PlayerScripts.Variables.Gold.Changed:connect(changed) function changed2() script.Parent.Text = "Wallet: " ..script.Parent.Parent.Parent.Parent.Parent.PlayerScripts.Variables.Gold.Value.. "/" ..script.Parent.Parent.Parent.Parent.Parent.PlayerScripts.Variables.MaxGold.Value end wait(5) script.Parent.Parent.Parent.Parent.Parent.PlayerScripts.Variables.Gold.Changed:connect(changed) script.Parent.Parent.Parent.Parent.Parent.PlayerScripts.Variables.MaxGold.Changed:connect(changed2)
In case that still hasn't convinced you this script should work, here's how the player's PlayerGui looks.
https://i.gyazo.com/276b42a9c83a71545ec2cef074c31d27.png
I'm really stumped on this, because Variables is spelled the same each time and apparently it isn't a member of PlayerScripts.
The most likely cause for this is that you are using a Script instead of a LocalScript. Simply change your script into a localscript and it might work. Also, I changed the coding to be easier-to-read below:
wait() local Players = game:GetService("Players") local LocalPlayer = Players.LocalPlayer local PlayerScripts = LocalPlayer.PlayerScripts local Variables = PlayerScripts.Variables or PlayerScripts:WaitForChild("Variables") local Gold = Variables.Gold or Variables:WaitForChild("Gold") local MaxGold = Variables.MaxGold or Variables:WaitForChild("MaxGold") local TextLabel = script.Parent function goldChanged() TextLabel .Text = "Wallet: " ..Gold.Value.. "/" ..MaxGold.Value end function maxGoldChanged() TextLabel .Text = "Wallet: " ..Gold.Value.. "/" ..MaxGold.Value end Gold.Changed:connect(goldChanged) MaxGold.Changed:connect(maxGoldChanged)