#Basic Problem

1 messages · Page 1 of 1 (latest)

warm lark
#

Hello everyone, I'm new to scripting.
I wanted to make a sphere like object when touched one point is added in the leaderstats but I'm getting an issue that when touched instead of one point multiple points are added. I knew that it is causing due to the touch of more than one body parts. How should I avoid it?
Please help!!

coarse sonnetBOT
#

studio** You are now Level 1! **studio

rancid harbor
#

Or just utilize an if statement to only award a point if the value is <=0

warm lark
bright vapor
#

bruh wait

#

local debounce = false

script.Parent.Touched:Connect(function(hit)
  if debounce = false then
    debounce = true
    print("e")
    wait(1)
    debounce = false
  end
end)
#

there

#

@warm lark

warm lark
#

thank you

bright vapor
#

What this does is checks if a variable named debounce is false, if it is it will turn debounce (cooldown) to true, run the code, wait 1 second and turn the cooldown off meaning you can touch the part again

#

happy scripting!

warm lark