this seems correct, try this instead of the code I sent above.
Wait, is the PressedEvent firing AFTER the stress ball MouseButton1Click fires, but somehow the PressedEvent fires BEFORE the cheese steak MouseButton1Click fires?
2 Likes
That could be the case, but I don’t know how I would test that
local CanPress = true
PressedEvent.Event:Connect(function()
if CanPress then
CanPress = false
task.wait(Cooldown.Value)
CanPress = true
end
end)
This is the script above the functions
You are asking to put this inside the functions instead?
Could you show me what you mean?
you would do for both [obviously change values for cheesesteak]: (and get rid of the top function)
MainFrame.StressBall.MouseButton1Click:Connect(function()
if CanPress.Value == true then
CanPress.Value = false
Equip(ShopTools["Stress Ball"], ShopTools["Stress Ball"].Name)
task.wait(Cooldown.Value)
CanPress.Value = true
else
print("Can press = false") -- This one works
end
end)
Also, I noticed that you’re using value instances. Instead, I would recommend just using variables. Especially if these values are only used in one script.
2 Likes
That works perfectly, thank you!!!
2 Likes
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.