So I’m making a system where if a player sits on a seat, then that player can click on the screen and earn money.
But why is it that every time I jump “Get out of Seat” and then I sit down again, the value will increase by 2 times, which previously only increased +1 if I left clicked, but when I jump and sit down again the value becomes +2, and this it happens again and again until i got a really huge value.
This is my code, if there is an mistakes please tell me:
– LocalScript
if isSeat then
if seat.Name == "WorkSeat" then
deb = true
print("You're Working!")
mouse.Button1Down:Connect(function()
if deb == true then
remote:FireServer()
end
end)
else
deb = false
end
end
if not isSeat then
deb = false
end
– ServerScript
local RS = game:GetService("ReplicatedStorage")
local remote = RS:WaitForChild("RemoteEvent")
remote.OnServerEvent:Connect(function(plr)
plr.leaderstats.Coins.Value += script.Value.Value
end)