What do you want to achieve? Keep it simple and clear!
Im making a system where it would load the tool that the player had before leaving the game. Basically a tool saving system
What is the issue? Include screenshots / videos if possible!
It keeps saying “Infinite yield possible on ‘ServerStorage:WaitForChild(“Paper1”)’” even though “Paper1” exists
Here is the script:
while true do
game.ServerStorage:WaitForChild("Paper"..tostring(game.Players.LocalPlayer:WaitForChild("SecretFolder").Paper.Value+1)):Clone().Parent = game.Players.LocalPlayer.Backpack
if game.Players.LocalPlayer.Backpack:WaitForChild("Paper"..tostring(game.Players.LocalPlayer:WaitForChild("SecretFolder").Paper.Value+1)) then
break
end
end
EDIT: After some time of debugging. This is what i came up:
local plr = game.Players.LocalPlayer
game.ReplicatedStorage.RemoteEvent1.OnClientEvent:Connect(function()
while true do
print("a")
local PaperTool = game.ReplicatedFirst:FindFirstChild("Paper"..(plr.SecretFolder.Paper.Value+1)):Clone()
PaperTool.Parent = plr.Backpack
print("ab")
if plr.Backpack:FindFirstChild("Paper"..tostring(plr.SecretFolder.Paper.Value+1)) then
print("break loop")
break
end
end
end)
For some reason it prints “break loop” despite still not having the tool stored in my inventory