This is inside a part in Workspace.
local part = script.Parent function onTouch(player) local wand = game.ReplicatedStorage.Tool:Clone() wand.Parent = player.Backpack end script.Parent.Touched:connect(onTouch)
I get this error Backpack is not a valid member of Part
The Touch Parameter returns your the object that triggered the event to access the Player you'll need to use GetPlayerFromCharacter()
local part = script.Parent function onTouch(player) local wand = game.ReplicatedStorage.Tool:Clone() local Player = game.Players:GetPlayerFromCharacter(player.Parent)--Getting the Player using the Character. if Player then--This prevent errors from occurring, like for example if your function was triggered by an object it won't have a Backpack would it? wand.Parent = Player.Backpack end end script.Parent.Touched:connect(onTouch)
~UserOnly16Charcters, Hoped I helped you to answer your question! If you have any further question, don't hesitate to comment below!!