When the Player Touches a brick they get a LinkedSword. this is not working...
script.Parent.Touched:connect(function(player) -- Getting brick and defining the player. end) script.Parent.Touched:connect(function(player) local Tool = game.Workspace.LinkedSword:Clone(); -- Defining a tool that will be cloned. Tool.Parent = player.Backpack; -- Defining the parent of the cloned tool. end)
The touched event connects the part that touched it, not the player, what you can do is:
script.Parent.Touched:connect(function(part) if part.Parent:FindFirstChild("Humanoid") then -- checking if the part is a child of the character player = game.Players:GetPlayerFromCharacter (part.Parent) -- find the player Tool = game.Workspace.LinkedSword:Clone() Tool.Parent = player.Backpack end end)
And there you go.