local rp = game:GetService("ReplicatedStorage") local Barrage = rp:WaitForChild("SPRemotes"):WaitForChild("BarrageHold (SP)") local active = false script.Parent.MouseButton1Click:connect(function() Barrage:FireServer(active) end)
Here is my basic code, though once ran it says Infinite yield possible on 'ReplicatedStorage.SPRemotes:WaitForChild("BarrageHold (SP)")'
What does this mean and how can I fix it?
Try this
local function WaitForChild(parent, childName) while not parent:FindFirstChild(childName) do parent.ChildAdded:wait() end return parent[childName] end local rp = game:GetService("ReplicatedStorage") local SPRemotes = WaitForChild(rp, "SPRemotes") local Barrage = WaitForChild(SPRemotes, "BarrageHold (SP)") local active = false script.Parent.MouseButton1Click:Connect(function() Barrage:FireServer(active) end)