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 » Scripting Helpers
Home Search
 

Re: My error.

Previous Thread :: Next Thread 
BossofBossed is not online. BossofBossed
Joined: 08 Dec 2012
Total Posts: 11
17 Dec 2012 09:30 PM
Can I please have some help here:


function Touch(hit)
if hit.Parent.Name == "Player1" then
print("inprosses")
if hit.Parent:IsA("Hat") then
hit.Parent.Humanoid.Health = 0
print("dead")
elseif hit.Parent.Name ~= "Player1" then
print("working")
hit.Parent.Torso.CFrame = CFrame.new(Vector3.new(0, 50, 0))
end
end
end
script.Parent.Touched:connect(Touch)

it only does the first if not the second please help.
Report Abuse
CokeCody is not online. CokeCody
Joined: 31 Mar 2010
Total Posts: 394
17 Dec 2012 09:38 PM
hit.Parent.Torso.CFrame = CFrame.new(0, 50, 0)
Report Abuse
megaguy44 is not online. megaguy44
Joined: 28 Sep 2008
Total Posts: 1066
17 Dec 2012 09:39 PM
What exactly are you trying to do in this script?


print('Hello World!')
Report Abuse
CokeCody is not online. CokeCody
Joined: 31 Mar 2010
Total Posts: 394
17 Dec 2012 09:41 PM
Hats don't have a humanoid so it'd be
if hit.Parent:IsA("Model") and hit.Parent:findFirstChild("Humanoid", true) then
Report Abuse
BossofBossed is not online. BossofBossed
Joined: 08 Dec 2012
Total Posts: 11
21 Dec 2012 06:15 PM
Look i=the Handle of the hat touches the brick. This dose not have a humanoid therefore causing an error. I am trying to run a function to test if it is a "Hat".
Report Abuse
BossofBossed is not online. BossofBossed
Joined: 08 Dec 2012
Total Posts: 11
21 Dec 2012 06:22 PM
Thanks it worked. Silly me. Running a test if it was a MODEL instead of a hat would not need the 3D function
Report Abuse
notsopwnedg is not online. notsopwnedg
Joined: 07 Nov 2010
Total Posts: 4182
21 Dec 2012 06:25 PM
function Touch(hit)
if hit.Parent.Name == "Player1" then
print("inprosses")
if hit.Parent:FindFirstChild("Humanoid",true) then
for _,v in pairs(script.Parent:GetChildren())
if v:isA("Hat") the
hit.Parent.Humanoid.Health = 0
print("dead")
end
end
elseif hit.Parent.Name ~= "Player1" then
print("working")
hit.Parent.Torso.CFrame = CFrame.new(Vector3.new(0, 50, 0)
end
end
end
script.Parent.Touched:connect(Touch)

This would kill you if you have a hat of that's what you intended...if not what do you want it to do...
Report Abuse
notsopwnedg is not online. notsopwnedg
Joined: 07 Nov 2010
Total Posts: 4182
21 Dec 2012 06:25 PM
Grrr I always do that...
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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