What I mean is. I have a weapon and I also have a GUI and the text is set at 25. When I fire the weapon I want it to subtract from the text label. I don't know how to do this. What would I write in the code. My guess was something like this.
fire = true game.StarterGui.ScreenGui.Frame.Label.Text = -1
I don't know something along those lines. I just need some help.
If you looking to subtract from a string
value you need to use tonumber
For example if you wanted your TextLabel's text to have 5 taken away each time the player clicks a button then it would go like this:
script.Parent.MouseButton1Click:Connect(function() script.Parent.Parent.TextLabel.Text = tonumber(script.Parent.Parent.TextLabel.Text) - 5 end
And just for good measure, DON'T ACCESS GUIS THROUGH STARTERGUI. You need to Access it from the PlayerGui so use script.Parent to find what you are looking for.