Okay. So I made a part that when someone touches it, the intvalue goes up by 1 and when someone clicks on a button that value goes down by 1. The problem is that after someone clicked that button, the value goes down by 1, but after when someone touched the part to add to the value, it adds up 2 instead of 1. Here is the script in the part:
script.Parent.Touched:Connect(function(hit)
if script.Parent.Reload.Value == false then
if hit.Parent:FindFirstChild("Humanoid") ~= nil then
if script.Parent.Players.Value < 5 then
script.Parent.Reload.Value = true
script.Parent.Players.Value = script.Parent.Players.Value +1
`the "Players" is the name of the value`
hit.Parent.HumanoidRootPart.CFrame = CFrame.new(game.Workspace.BallonPart.Position)
local gui = game.ReplicatedStorage.ScreenGui:Clone()
gui.Parent = game.Players:WaitForChild(hit.Parent.Name).PlayerGui
end
end
end
wait(2)
script.Parent.Reload.Value = false
end)
and here's the script in the button:
script.Parent.MouseButton1Click:Connect(function()
game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame = CFrame.new(game.Workspace.SpawnLocation.Position)
game.Workspace.Part.Players.Value = game.Workspace.Part.Players.Value -1
script.Parent.Parent.Parent:Destroy()
end)
I think that the 1st script is ignoring the changes made from the 2nd script, so it just keeps adding, but idk how to fix it. Altough the 2nd script isn't ignoring, because it is renewed every time (cloned and destroyed) so it forgets the value of the intvalue.
I'm sure that there is an way out of that and help will be appreciated!

10 comments
You need a debounce in the first script.
wait but I've added a debounce in my 1st script
well it's not enough
I thing the 1st script is ignoring the changes made from the 2nd script, so it just keeps adding, but idk how to fix it.
Are you using a local script in the second one? Is it meant to be a GUI?
yes.
GUYS PLEASE I NEED SOME HELP
IntValue.Value = IntValue.Value + x; (with
xbeing a number)oh so "x" has to be a variable?
x doesn't have to be a variable; lemme make an answer for you