How do i make script that give me a sword
Well, elaborate a bit. How do you want the game to know wehn to give you the sword. By touching a brick? When a value has reached a certain specified point? Start of the server? When you join?
Getting the sword is easy. Store it in lighting and use the clone method to get a copy of the sword into your backpack;
game.Lighting:FindFirstChild("Linked Sword"):Clone().Parent = game.Players.decade111.Backpack --Replace 'Linked Sword' with whatever the sword is named.
But again, elaborate a bit. When do you want the sword.
Okay, you want to give a player a sword when they touch a brick. I will create the script for you but I will also tell you what everything does and how it's set up.
brick = script.Parent -- this is the brick that you want to be touched to give you a sword. sword = game.Lighting:FindFirstChild("Sword") -- Put the sword in lighting. You will see why soon. brick.Touched:connect(function (player) -- what this says is when the brick is touched it will 'fire' the function, or make the function activate. if player.Character.Humanoid then -- this will make sure that it doesn't just give it to a brick. local give = sword:clone() -- this is creating a clone of the sword. give.Parent = player.Backpack -- this is putting the sword into the player's backpack end end) -- this ends the function
All you have to do is put a script inside the brick and paste this inside the script. Along with putting a sword in lighting and having it be named 'Sword'.
Please +1 if this has helped you! :D
Closed as Too Broad by 2eggnog, fireboltofdeath, and Shawnyg
This question has been closed because it is too broad and is generally unanswerable. Please ask a more specific question.
Why was this question closed?