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

How do I fix this? Gear from ServerStorage won't be put into players backpack after proximityPrompt

Asked by 1 year ago
Edited 1 year ago

Hello! I am trying to make a sneaky sort of easter egg for my game, Yet it has been quite a while since i've done this sort of scripting. Anywho I have a proximity prompt on a meshpart, which when done will make the part disappear, play a sound and then give you a special gear, however when trying to put the gear into the players backpack or starter folder it returns

"Workspace.[ParentPartNameHere].Script:22: attempt to index nil with 'Backpack' "

I know i'm probably missing something obvious, but any and all help is appreciated!

--Blank Space for some reason
--Same
--Triple
local sound = Instance.new("Sound", script.Parent.Parent)
sound.SoundId = "rbxassetid://11192064466" 
sound.EmitterSize = 5
sound.Looped = false
sound.Parent = script.Parent.Parent

local PM = script.Parent.Parent:FindFirstChild("ParticleEmitter")

script.Parent.Triggered:Connect(function(player)
    PM.Enabled = true
    sound:Play()
    wait(0.5)
    for i = 25,1,-1 do
        script.Parent.Parent.Transparency += 0.04
        wait(0)
    end
    print(player)
    local coco = game.ServerStorage["Coconut Elite Phone"]:Clone()
    coco.Parent = game:GetService("Players"):FindFirstChild(player).Backpack
    script.Parent.Parent:Destroy()

end)

[Fixed!, Had to do player.Name]

Answer this question