I'm trying to make a gamepass that gives you devil powers. The way I'm trying to do it is by making a folder in server storage and then putting all the local scripts for the powers in that and then cloning it into the player backpack.
Heres my code
ServerStorage = game:GetService("ServerStorage") local id = 13229693
game:GetService("MarketplaceService").PromptGamePassPurchaseFinished:Connect(function(plr,ido,purchased)
if purchased and id == ido then
plr.Character.Humanoid.WalkSpeed = 20
end
end)
game.Players.PlayerAdded:Connect(function(plr)
if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(plr.UserId,id) then
game.Workspace:WaitForChild(plr.Name):WaitForChild("Humanoid").WalkSpeed = 20
local Devil = ServerStorage:WaitForChild("Devil"):Clone()
Devil.Parent = game.Players.LocalPlayer.BackPack
end
end)

3 comments
WaitForChild(plr.Name) is the one that is giving you trouble. Remove it, since A. It's unnecessary, and B. It'll go on forever. Otherwise, just ignore since that scripts can continue even if the warning is present. Also you can't use LocalPlayer on a Server Script.
Ok thanks but the script is working fine with the WaitForChild(plr.Name), and it says "Infinite yield possible on ServerStorage:WaitForChild("Devil") also if I can't use LocalPlayer on a ServerScript then how am I gonna clone it to whoever buys the gamepass?
Nvm about the LocalPlayer stuff