local Player = game:GetService("Players").LocalPlayer
local rp = game:GetService("ReplicatedStorage")
local Barrage = rp:WaitForChild("BarragePress")
local UIS = game:GetService("UserInputService")
local debounce = false
local cooldown = 3
UIS.InputBegan:Connect(function(input,IsTyping)
if IsTyping then
return
elseif input.KeyCode == Enum.KeyCode.F then
if workspace:FindFirstChild(Player.Name.." Stand") then
if debounce == false then
debounce = true
Barrage:FireServer()
end
end
end
end)
Barrage.OnClientEvent:Connect(function()
wait(cooldown)
debounce = false
end)
local Player = game:GetService("Players").LocalPlayer
local rp = game:GetService("ReplicatedStorage")
local Barrage = rp:WaitForChild("BarrageHold")
local UIS = game:GetService("UserInputService")
local debounce = false
local active = false
local cooldown = 3
UIS.InputBegan:Connect(function(input,IsTyping)
if IsTyping then
return
elseif input.KeyCode == Enum.KeyCode.F then
if workspace:FindFirstChild(Player.Name.." Stand") then
if debounce == false and active == false then
debounce = true
Barrage:FireServer(active)
end
end
end
end)
UIS.InputEnded:Connect(function(input,IsTyping)
if IsTyping then
return
elseif input.KeyCode == Enum.KeyCode.F then
if workspace:FindFirstChild(Player.Name.." Stand") then
if debounce == true and active == false then
active = true
Barrage:FireServer(active)
end
end
end
end)
Barrage.OnClientEvent:Connect(function()
wait(cooldown)
active = false
debounce = false
end) ~~~~~~~~~~~~~
whenever i press F i get a error message is there something i did wrong?
ERROR:Infinite yield possible on 'ReplicatedStorage:WaitForChild("BarragePress")'
✓ ANSWER ACCEPTED
How do i make 'F' do something and fixinfinite yield?
1 answer
✓ Accepted answer
Infinite yield just means that the script is paused. Probably because it couldn't find your BarragePress, so it just waited forever for it to exist. Make sure BaragePress is an actual thing in the ReplicatedStorage.
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
the error is under line 2