Hello! So I’m quite confused and stuck because im pretty sure local scripts handle screengui buttons, but at the same time leaderstats can only be changed by server side scripts. (I think so I’m not too sure.) So as the title says, I want it so when i press a button, my leaderstats.Stage goes down by 1. This is what I have so far:
local button = script.Parent
button.MouseButton1Click:Connect(function()
local stage = game:FindFirstChild("leaderstats",true).Stage
stage -= 1
end)
This script is in a local script inside of a textbutton.
When I test the game, I get this error:
01:01:36.034 Players.rutp2.PlayerGui.StageNavigation.PreviousStageButton.PreviousStageScript:5: attempt to perform arithmetic (sub) on Instance and number - Client - PreviousStageScript:5
01:01:36.034 Stack Begin - Studio
01:01:36.034 Script 'Players.rutp2.PlayerGui.StageNavigation.PreviousStageButton.PreviousStageScript', Line 5 - Studio - PreviousStageScript:5
01:01:36.034 Stack End - Studio
Any help is greatly appreciated!