so I’ve been stumped for quite a few hours(I wanted to figure it out myself, for learning), but I can fix this error. here’s my script:
local ArrowHealth = game.Players.LocalPlayer:WaitForChild("Stats"):WaitForChild("ArrowHealth")
local SpeedA = game:GetService("ReplicatedStorage"):WaitForChild("SpeedingArrows")
SA = script.Parent.SA
ArrowHealth.Changed:Connect(function()
if ArrowHealth.Value <= 0 then
if script.Ended.Value == false then
script.Ended.Value = true
local Cloned = SpeedA:Clone()
Cloned.Parent = script.Parent
for i, v in pairs(SA) do -- The Error lies here
if v:IsA("LocalScript") then
v:Destroy()
end
end
wait(1)
script.Parent.SA:Destroy()
script:Destroy()
end
end
end)
and here’s my error:
Players.TOP_Crundee123.PlayerGui.SpeedingArrows.Detection:11: bad argument #1 to ‘pairs’ (table expected, got Object)
I am wondering how to fix it.