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

Why is my tool not going in the backpack inventory?

Asked by 3 years ago

Basically, my tool isn't equipping right and i made a script for it.

script.Parent.Parent.Equipped:Connect(function()
    local player = game.Players.LocalPlayer
    local tool = script.Parent.Parent:Clone()
    tool.Parent = player.Backpack
end)

No errors. I checked the backpack and saw nothing was there. Am I doing something wrong?

0
Is the event firing properly? Put a print in there and see if it fires. Benbebop 1049 — 3y
0
k xbendaiialt 44 — 3y
0
... i added a print and it made an error. "Equipped is not a valid member of Backpack "Players.xBenDaii.Backpack" xbendaiialt 44 — 3y
0
woops, i didnt put the model in the tool, still doesnt work in the tool though xbendaiialt 44 — 3y
View all comments (3 more)
1
Are you going too far back? It seems like you are indexing the backpack instead of the tool, try removing one of the ".parents". Benbebop 1049 — 3y
0
Are you sure that "script.Parent.Parent" is referring to the tool? oilsauce 196 — 3y
0
yes xbendaiialt 44 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago

May or may not fix issues for you:

script.Parent.Parent.Equipped:Connect(function()
2       local player = game.Players.LocalPlayer
3       local tool = script.Parent.Parent
4       tool:Clone().Parent = player.Backpack
5   end)
Ad

Answer this question