This button when pressed should be decreasing 1 from the stage Value and adding 1 to the test Value, but it is not working yet there are no errors marked.
(ds is the datastore)
local player = game.Players.LocalPlayer local test = player.ds.Test local stage = player.leaderstats.Stage.Value DB = true function Click() if DB == true then DB = false stage.Value = stage.Value -1 wait(1) test.Value = test.Value +1 end wait(1) -- Time until button can be pressed again. DB = true end script.Parent.MouseButton1Down:connect(Click)
Oops, you have an small typo on your script:
local player = game.Players.LocalPlayer local test = player.ds.Test local stage = player.leaderstats.Stage -- here your error: You should connect a variable to an object and not to a property, i corrected it. DB = true function Click() if DB == true then DB = false stage.Value = stage.Value -1 wait(1) test.Value = test.Value +1 -- you were doing something like player.leaderstats.Stage.Value.Value - any sense? end wait(1) -- Time until button can be pressed again. DB = true end script.Parent.MouseButton1Down:connect(Click)
Finnaly, to check if something really works, you can use the output
local player = game.Players.LocalPlayer local test = player.ds.Test -- on this case, test = 1 local stage = player.leaderstats.Stage -- on this case, stage = 10 DB = true function Click() if DB == true then DB = false print(stage.Value) -- will print 10 stage.Value = stage.Value -1 print(stage.Value) -- will print 9 wait(1) print(test.Value) -- will print 1 test.Value = test.Value +1 print(test.Value) -- will print 2 end wait(1) DB = true end script.Parent.MouseButton1Down:connect(Click)
Hope I helped!