Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to make a script give you sword when a duel start ?

How do i make script that give me a sword

1 comment

0

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

2 answers

✓ Accepted answer

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

0

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

0

thanks buy how can i repeat this

0

repeat what exactly?

0

oh man it didn't work

0

can you make another script ?

0

What was the error?

0

i step on it and nothing happen

0

no error?

0

anything yet ?

This discussion is preserved as it was. New answers, comments, and votes are closed.