Hello scripters!
Recently I started making a new game and I encountered an issue that NEVER happened to me.
Basically whenever I click on a click detector, or trigger a proximity prompt SOMETIMES they get fired TWICE!!!
I also tried to use a debounce but it doesn’t work…
And as I said, sometimes it fires Twice, sometimes it fires only once…
It’s the first time that this happens to me, anybody knows a possible fix?
Here’s the click detector script:
script.Parent.ClickDetector.MouseClick:Connect(function(plr)
if script.Parent.Parent.Parent.Owner.Value == tostring(plr.UserId) then
print("GO")
script.Parent.Parent.IsActivated.Value = not script.Parent.Parent.IsActivated.Value
end
end)
This might be because of the new framerate system. Try playing on 60hz if you’re not already and if the problem persist try another mouse or reinstalling Roblox Studio. Unless Roblox do something about the framerates the bug will remain for a long time.
It’s usually recommended to place the debounce/stop flag at the beginning before running anything else. For your script, you can either place it on the line before the print, or place before the if statement (however, you’ll need to include an else to reset the value). If not, it very well may be the case mentioned by @FreddDeWB and @Xynterical.