I've been looking and I can't find a way to be able to loop a whole script. This is because I am trying to keep looping a check that sees if a player has something in their inventory. Instead, if I were to but a while loop into the section it only loops the check but I want it to loop the whole script because there is a gun script under it (this is the "this gun for fps" assault rifle script.) Because it is only looping the check for the players inventory the gun does not function. Please help.
Thank you!
(script)
while true do --Supposed to loop the whole script but it only loops until the end.
wait()
if game.Players.LocalPlayer.Backpack:FindFirstChild("MinionWeaponSpeed") then
FireRate = 3.75/30
else
FireRate = 5/30
end
end
--------------------- TEMPLATE ASSAULT RIFLE WEAPON ---------------------------
-- Waits for the child of the specified parent
local function WaitForChild(parent, childName)
while not parent:FindFirstChild(childName) do parent.ChildAdded:wait() end
return parent[childName]
end

2 comments
Instead of doing the loop, I think you could just do game.Players.LocalPlayer.Backpack.ChildAdded:Connect(function(child) [CODE] end). It will run whenever a tool is added to the player's backpack.
Tysm!!!!