How do i make script that give me a sword
How to make a script give you sword when a duel start ?
2 answers
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.
1 comment
when i touch the brick i wanna get a 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
8 comments
thanks buy how can i repeat this
repeat what exactly?
oh man it didn't work
can you make another script ?
What was the error?
i step on it and nothing happen
no error?
anything yet ?
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
well i want it to give players sword when they touch a brick