#variable over multiple localscripts
10 messages · Page 1 of 1 (latest)
it's a script to increase the value of a currency by 1 or decrease it by 1
the blue button increases it, the red button decreases it
Easiest solution to your problem
-- place the script under your ScreenGui
local ScreenGui = script.Parent
local whitestuff = 0
local function AddClicked()
whitestuff += 1
ScreenGui.Label.Text = "yourtext "..whitestuff
end
local function SubtractClicked()
whitestuff -= 1
ScreenGui.Label.Text = "yourtext "..whitestuff
end
-- rename the blue button which gives 1 to "GiveButton"
-- rename the red button which subtracts 1 to "SubtractButton"
screenGui["GiveButton"].MouseButton1Click:Connect(AddClicked)
screenGui["SubtractButton"].MouseButton1Click:Connect(SubtractClicked)
I'd recommend not using local whitestuff = 0 at all and making a leaderstat Whitestuff for each player if you want every other player to have a different currency amount
or give players an IntValue attribute Whitestuf and add to that every time
do you know how to make the leaderstat or is it already in the code?