|
| 23 Dec 2015 03:30 AM |
Trying to make a weapon giver. Here is the script:
local touched = false
script.Parent.Part.Touched:connect(function(hit) local player = hit.Parent if player:FindFirstChild("Humanoid") then if player ~= nil then if player == script.Parent.Parent.Parent.Owner.Value then if player.Backpack:FindFirstChild("Sword") == false then local weapon = game.ServerStorage.ToolStorage.Sword:Clone() weapon.Parent = player.Backpack local touched = true script.Parent.Part.BrickColor = BrickColor.new("Really red") wait(2) local touched = false script.Parent.Part.BrickColor = BrickColor.new("Medium stone grey") end end end end end)
|
|
|
| Report Abuse |
|
|
|
| 23 Dec 2015 03:42 AM |
This isn't really enough information to help. Is it not working? Where is the script located? Do you have an object named "ToolStorage" in your ServerStorage with a tool named "Sword" in it?
~ Brickman2010, Developer of Heist ~ |
|
|
| Report Abuse |
|
|
|
| 23 Dec 2015 09:25 PM |
Yes to all the questions above! Also I found out why it wasn't working.
local player isn't hit.Parent, its game.Players:GetPlayerFromCharacter(hit.Parent)
Might not be the solution. Texting it right now! |
|
|
| Report Abuse |
|
|
|
| 23 Dec 2015 09:28 PM |
| The humanoid is situated in the character so I'm not too sure that would be the solution... |
|
|
| Report Abuse |
|
|
|
| 23 Dec 2015 09:36 PM |
Yep not the solution. Ok here is the branches or ancestry
ServerStorage has ToolStorage which was a tool called "Sword"
The script is located in a model called "SwordGiver"
SwordGiver's children are the script(GiverScript) , a part(Part) and another part(named blank)
That is all i can give you. Help? |
|
|
| Report Abuse |
|
|
|
| 23 Dec 2015 09:38 PM |
@cows
I'm trying your solution now by doing:
if hit.Parent:FindFirstChild("Humanoid") then ...
instead of
if player:FindFirstChild("Humanoid") |
|
|
| Report Abuse |
|
|
|
| 23 Dec 2015 09:39 PM |
YES IT WORKED, COWS!
THANK YOU SO MUCH! |
|
|
| Report Abuse |
|
|