I need help making a script that gives a sword when you touch a brick.
How do I make it where when you touch a brick it gives a sword?
6 answers
I need all the help I can get, Thanks.
Here's what I think: First of all put a sword in the lighting and name it "Sword" then make a part in the Workspace and put this script in it:
script.Parent.Touched:connect(function(hit)
local find = hit.Parent:FindFirstChild("Humanoid")
if find then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
local findS = player.Backpack:FindFirstChild("Sword")
if not findS then
local sword = game.Lighting.Sword:Clone()
sword.Parent = player.Backpack
end
end
if not find then
print('no humanoid')
end
end)
Here's my answer: What you're talking about is a giver. Here I have a link that'll get you started maybe without a script: http://www.roblox.com/Basic-Giver-item?id=3140741
(put inside the brick to be hit)
Incase you are still wondering;
local spam_prevention = false
script.Parent.Touched:connect(function(hit)
print("Reaper5 was here")
IsPlayer = hit.Parent.Parent:FindFirstChild("Humanoid")
if IsPlayer ~= nil then
if spam_prevention == false then spam_prevention = true end
Tool_To_Give = game.Lighting.Sword:Clone() --Change "Sword" to what tool you want to be given
player_ = game.Players[hit.Parent.Parent.Name]
Tool_To_Give.Parent=player_.Backpack
wait(1)
spam_prevention=false
end
end)
I recommend just using a free model.
There are 2 ways you can do this, Insert a brick and name it Handle. (Do not do this if there is a part already in the tool) ~ OR ~ Create a brick then insert your tool in the brick. If there is already a brick in the tool it will be visible so hide somewhere that no one can see. (This will NOT affect the tool's handle position. It will attach to the character's arm.
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
You're welcome.
I'm not wanting a giver, but I think I found my answer. When people get chose to go into the arena, I put the sword into lightning.