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

Cloning A Tool Into A Player's Backpack? [Answered] [closed]

Asked by
Omarstein 100
9 years ago

Script:

script.Parent.MouseButton1Click:connect(function()
    script.Parent.BackgroundColor3 = Color3.new(255,0,0)
    key = game.ServerStorage.RoomKeys.Room1
    clone = key:Clone()
    compuser = game.Workspace.Comp1Plr
    plr = game.Players:FindFirstChild(compuser.Value)
    print("Found Computer User.") --It does print that
    clone.Parent = plr.Backpack
end)

OutPut: Workspace.Comp1.Screen.SurfaceGui.AvailableRooms.Room1.Scri:8: attempt to index global 'plr' (a nil value)

2
It most likely is because you did something wrong, and that is not an actual player? Tempestatem 884 — 9y
1
I agree with Tempestatem. Your output means that 'plr' is nil. Thewsomeguy 448 — 9y
0
Thanks guys, the player's name was not recorded in the string value thats why, I fixed it now. Thanks! Omarstein 100 — 9y

Locked by TofuBytes, adark, and Shawnyg

This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.

Why was this question closed?