of     1   

asimo3089
#139486281Monday, July 07, 2014 2:18 AM GMT

Hey everybody I'd love some help on this. I have a large button that triggers these automatic doors when a player is nearby. My problem is that while I walk on this large button, my "Current" value bounces between 2 and 0. My guess is it's tracking the player and both his legs? How can I fix this? function ontouched(hit) if hit.Parent:FindFirstChild("Humanoid")~=nil then current.Value = current.Value + 1 end end script.Parent.Touched:connect(ontouched) function onleave(hit) if hit.Parent:FindFirstChild("Humanoid")~=nil then current.Value = current.Value - 1 end end script.Parent.TouchEnded:connect(onleave)
AnonyAnonymous
#139486480Monday, July 07, 2014 2:20 AM GMT

Try adding debounce.
jode6543
#139486596Monday, July 07, 2014 2:20 AM GMT

Try this: function ontouched(hit) if hit.Parent:FindFirstChild("Humanoid")~=nil and current.Value == 0 then current.Value = 1 end end script.Parent.Touched:connect(ontouched) function onleave(hit) if hit.Parent:FindFirstChild("Humanoid")~=nil and current.Value == 1 then current.Value = 0 end end script.Parent.TouchEnded:connect(onleave) Note that .TouchEnded is also somewhat glitchy and doesn't always work right; testing a FindPartsInRegion3 above the button is more reliable. ~Jode

    of     1