Hey Guys! So, a friend and I are working on a script. The whole purpose of the script is for a number value increase just by clicking on an ImageButton. What we tried was we using "MouseButton1Cick", if you can help us or give us any advice please do. We're working on a project and the purpose is for it to change everytime you click an arrow to the right.
local player = game.Players.LocalPlayer local char = player.Character or player.CharacterAdded:wait() local number = script.Parent.Parent.Number local humanoid = char:WaitForChild('Humanoid') local torso = char:WaitForChild('Torso') local torsogui = torso:WaitForChild('Number') local guitext = torsogui:WaitForChild('TextLabel') local debounce = true function Increase() if number.Value < 0 then number.Value = number.Value + 1 end number.Value = number.Value + 1 end script.Parent.MouseButton1Click(function() if debounce then debounce = false Increase() wait(1) debounce = true end end)
Here is a screenshot so you can understand. StarterGui - https://prnt.sc/fu2x93 Script - https://prnt.sc/fu2xi9
local player = game.Players.LocalPlayer local char = player.Character or player.CharacterAdded:wait() local number = script.Parent.Parent.Number.Number --You're using TextLabel, So I added the children of the TextLabel , which is the IntValue or Number local humanoid = char:WaitForChild('Humanoid') local torso = char:WaitForChild('Torso') local torsogui = torso:WaitForChild('Number') local guitext = torsogui:WaitForChild('TextLabel') local debounce = true function Increase() if number.Value < 0 then number.Value = number.Value + 1 end number.Value = number.Value + 1 end script.Parent.MouseButton1Click(function() if debounce then debounce = false Increase() wait(1) debounce = true end end)