Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

I want to parent a tool to a player's backpack. The script leaves no errors?

This is my script in ServerScriptService.

local gear = game:GetService("ServerStorage"):WaitForChild("GravityCoil")

game.Players.PlayerAdded:Connect(function(plr)
	if plr.Name == "kingblaze_1000" then
		local clone = gear:Clone()
		print(clone.Name) --//Prints successfully.
		clone.Parent = plr:WaitForChild("Backpack")
	end
end)

Thanks for taking your time and I appreciated any attempt on answering my question

5 comments

0

All it means is that the if statement isn't running. Why are you checking that it's your username?/ what is the function intended for, specific people? If you're just checking yourself, I think it's because .Name is not a valid property of plr?

0

debug your script, add prints and look where the script stops working

0

I did. The script works all the way through. It even manages to print the name of the clone

0

That will obviously not work because it isn't happening on the server.

0

I tried it anyways and yeah it didn't work.

1 answer

✓ Accepted answer
local gear = game.ServerStorage:WaitForChild("GravityCoil")

game.Players.PlayerAdded:Connect(function(plr)
    if plr.Name == "itz_rennox" then
	repeat wait() until plr:WaitForChild("Backpack")
        gear:Clone().Parent = plr:WaitForChild("Backpack")
	end
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.