generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Game Design
Home Search
 

Re: HELP WITH SCRIPTING

Previous Thread :: Next Thread 
PokemonMaster8619 is not online. PokemonMaster8619
Joined: 17 Jan 2013
Total Posts: 57
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
Brickman2010 is not online. Brickman2010
Joined: 20 Nov 2009
Total Posts: 5547
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
PokemonMaster8619 is not online. PokemonMaster8619
Joined: 17 Jan 2013
Total Posts: 57
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
cowsoncows is not online. cowsoncows
Joined: 11 Oct 2013
Total Posts: 2522
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
PokemonMaster8619 is not online. PokemonMaster8619
Joined: 17 Jan 2013
Total Posts: 57
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
PokemonMaster8619 is not online. PokemonMaster8619
Joined: 17 Jan 2013
Total Posts: 57
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
PokemonMaster8619 is not online. PokemonMaster8619
Joined: 17 Jan 2013
Total Posts: 57
23 Dec 2015 09:39 PM
YES IT WORKED, COWS!

THANK YOU SO MUCH!
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Game Design
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image