Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Someone help fix this script to update money from a value to a text box?

Asked by 5 years ago

I am coding a simulator and you earn cash when you do certain things in the simulator and instead of using the leader-board method of collecting cash I am doing it a different way in a Gui.

Before I switched the game from Experimental Mode to Filtering Enabled this script worked fine and would update the money but as of switching it to FE the script no longer works but through testing I know the value has the amount of money it should in it but the textlabel does not project this as it should.

while true do
    wait(.5)
    script.Parent.Parent.moneydisplay.Text = "$"..script.Parent.Value
end

That is all the code and I just cant get my head round why it doesnt work.

2 answers

Log in to vote
0
Answered by 5 years ago

You shouldn't use while loops for those kinds of things. Use an event instead.

script.Parent.Changed:Connect(function(value)
    script.Parent.Parent.moneydisplay.Text = "$" .. value
end)
Ad
Log in to vote
0
Answered by 5 years ago

You need to use RemoteEvents. I'm not very good at explaining them, but there are multiple tutorials on how to use them. Also here is the Wiki page: https://wiki.roblox.com/index.php?title=API:Class/RemoteEvent

0
No. Not remote events. RemoteFunctions User#19524 175 — 5y
0
No, a RemoteEvent or a RemoteFunction is not necessary becuase the script and gui are already on the client side. IwanCodes 8 — 5y

Answer this question