What do you want to achieve?
I want my function to not affect the rest of my script.
What is the issue?
Currently my function has a wait in it, but I need it to not effect the script with the wait.
local Remote = game:GetService("ReplicatedStorage").Earth_Bender
function SetUpTimer(player)
task.wait(1)
player.Data.Debounces.EarthBenderDebounce.Value = false
end
Remote.OnServerInvoke = function(player, Info)
if player:FindFirstChild("Data") and player.Data:FindFirstChild("Debounces") and player.Data.Debounces:FindFirstChild("EarthBenderDebounce") and player.Data.Debounces.EarthBenderDebounce.Value == true then
return {"Player Can Not Use Ability!", "Player has tried to use the E Ability."}
end
if Info[1] == Enum.KeyCode.E then
print("Player press E!")
player.Data.Debounces.EarthBenderDebounce.Value = true
SetUpTimer(player)
return {"Player has used the E Ability."}
end
end
So, I need it to return, but also set up the function. It currently waits, then returns.
Edit: What if I make a table with the player in it and have a loop under all of this subtracting the debounce?
When A remote is called, the function won’t yield the whole script. It’ll launch a new thread and run the script asynchronously. I’d recommend changing that snippet right here from
Are you trying to remove the yield of the function? Yield means when a script has a wait() or some sort it can pause the rest of the script until it’s done.