It works up until the "sword.Parent = hit.Parent.Backpack" part. Here's the error: Backpack is not a valid member of Model
part = script.Parent serverstorage = game:GetService("ServerStorage") part.Touched:connect(function(hit) part.BrickColor = BrickColor.new("Really red") local sword = serverstorage:WaitForChild("Sword"):Clone() sword.Parent = hit.Parent.Backpack end)
Backpack is a descendant of a Player.
part = script.Parent serverstorage = game:GetService("ServerStorage") part.Touched:connect(function(hit) if game.Players:GetPlayerFromCharacter(hit.Parent) then p = game.Players:GetPlayerFromCharacter(hit.Parent) part.BrickColor = BrickColor.new("Really red") local sword = serverstorage:WaitForChild("Sword"):Clone() sword.Parent = p.Backpack end end)
You had a little mistake. Backpack isn't in the character. It's in the player.
THIS SCRIPT IS IN A LOCAL SCRIPT
part = script.Parent serverstorage = game:GetService("ServerStorage") part.Touched:connect(function(hit) part.BrickColor = BrickColor.new("Really red") local sword = serverstorage:WaitForChild("Sword"):Clone() sword.Parent = game.Players.LocalPlayer.Backpack --Backpack is in players. end)