Ad
Log in to vote
0

My Player.Backpack script isn't working. I dont know why but I am pretty sure I did it right though?

Asked by 11 months ago
Edited 11 months ago

local Sword = script.Parent local ReplicatedStorage = game:FindService("ReplicatedStorage") local SwordGive = ReplicatedStorage.ClassicSword

Sword.ProximityPrompt.Triggered:Connect(function(player) local SwordCopy = Sword:Clone() SwordCopy.Parent = player.Backpack end)

this is the script and it seems very easy to do but something is wrong with my backpack script or something and i cant figure it out.

1 answer

Log in to vote
0
Answered by 11 months ago

Where is the script at?

In the function, you copy "Sword" which is the script's Parent, Not "SwordGive" which is the tool in ReplicatedStorage

local Sword = script.Parent 
local ReplicatedStorage = game:FindService("ReplicatedStorage") 
local SwordGive = ReplicatedStorage.ClassicSword

Sword.ProximityPrompt.Triggered:Connect(function(player) 
    local SwordCopy = SwordGive:Clone() 
    SwordCopy.Parent = player.Backpack 
end)
Ad

Answer this question