Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 4 years ago
Edited 4 years ago

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

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? Primrose_Studio 53 — 4y
0
debug your script, add prints and look where the script stops working GamerJanko 50 — 4y
0
I did. The script works all the way through. It even manages to print the name of the clone kingblaze_1000 359 — 4y
0
That will obviously not work because it isn't happening on the server. kingblaze_1000 359 — 4y
0
I tried it anyways and yeah it didn't work. kingblaze_1000 359 — 4y

1 answer

Log in to vote
2
Answered by 4 years ago
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)
Ad

Answer this question