atease.MouseButton1Down:Connect(function() if debounce == true then for i = 1,#ranks do if rank == i then -- Same thing as written above, already made it rank-locked for you. rease:FireServer() end end else return end end)
That is the function, and the following is the associated variables:
-- Miscellaneous References local debounce = false local replicatedstorage = game:GetService("ReplicatedStorage") local player = game.Players.LocalPlayer -- Reference Group Ranks local ranks = {"Regulation Enforcement", "Adroit Enforcer", "Proficient Enforcer", "Auror Division", "Meister Auror", "Veteran Auror", "Magical Architects", "Division Foreman", "Professor"} local rank = player:GetRoleInGroup(3736685) print(rank) -- Remote Events local rbow = replicatedstorage:WaitForChild("MobileBow") local rease = replicatedstorage:WaitForChild("MobileEase")
I believe that the problem is
local debounce = false if debounce == true then end --it will never fun because you are basically doing this if false == true then end --false == true is falsey
A debounce should work like this:
local debounce = false atease.MouseButton1Down:Connect(function() if not debounce then debounce = true spawn(function() wait(1) --cooldown time for the debounce debounce = false end) --rest of the code end end
Well the thing is that you didn't get the player in the code. Find some way to get the player and write in the code or else the script won't recognise what is
for i = 1, #ranks do
for...Also when you :FireServer(), player is automatically passed as argument so if you didn't get the LocalPlayer the script will not work...