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: I need help!

Previous Thread :: Next Thread 
Xnite515 is not online. Xnite515
Joined: 18 Feb 2011
Total Posts: 22763
19 Sep 2011 03:32 PM
function onTouch(hit)
if script.Parent.Parent:FindFirstChild("Handle") nil then

if hit.Parent:FindFirstChild("Humanoid") nil then

if game.Players:FindFirstChild(humanoid.Parent.Name):IsInGroup(72321) true then

        hit.Parent.Humanoid.Health = hit.Parent.Humanoid.MaxHealth
        wait(2)
        
elseif game.Players:FindFirstChild(humanoid.Parent.Name):IsInGroup(72321) false then
end
end
end
end

script.Parent.Parent.Touched:connect(onTouch)


Whats wrong with it?

And can you tell me the right source code?
Report Abuse
Nagaris is not online. Nagaris
Joined: 18 Sep 2011
Total Posts: 422
19 Sep 2011 03:37 PM
:findFirstChild(What Ever Model Here)

NOT:

:FindFirstChild(What Ever Model Here)

"find" in findFirstChild shouldn't be capitalized.

Also, I am not quite fond of the IsInGroup function, but I think that after the Group ID, there should be an "="

IE: :IsInGroup(72321) = true then
Report Abuse
Nagaris is not online. Nagaris
Joined: 18 Sep 2011
Total Posts: 422
19 Sep 2011 03:38 PM
Correction.

:IsInGroup(72321) == true then




I failed....
Report Abuse
Xnite515 is not online. Xnite515
Joined: 18 Feb 2011
Total Posts: 22763
19 Sep 2011 03:38 PM
so can you give me the whole source code thats corected?

Just paste it please.
Report Abuse
Nagaris is not online. Nagaris
Joined: 18 Sep 2011
Total Posts: 422
19 Sep 2011 03:40 PM
Also, No need for the elseif

Seen as if it only happens IF the user is in the group, then it will only effect said player. So, you can also remove that, and it's end. I will post a revised script in a moment.
Report Abuse
Xnite515 is not online. Xnite515
Joined: 18 Feb 2011
Total Posts: 22763
19 Sep 2011 03:44 PM
Thanks for your your help :D
Report Abuse
Nagaris is not online. Nagaris
Joined: 18 Sep 2011
Total Posts: 422
19 Sep 2011 03:45 PM
function onTouch(hit)

if script.Parent.Parent:FindFirstChild("Handle") ~= nil and hit.Parent:FindFirstChild("Humanoid") and game.Players:FindFirstChild(humanoid.Parent.Name):IsInGroup(72321) == true then
hit.Parent.Humanoid.Health = hit.Parent.Humanoid.MaxHealth
wait(2)
end

script.Parent.Parent.Touched:connect(onTouch)


(That big chunk at the top should be 1 line.)
Report Abuse
Nagaris is not online. Nagaris
Joined: 18 Sep 2011
Total Posts: 422
19 Sep 2011 03:46 PM
Jeeze I messed up... Slightly alter that...


function onTouch(hit)

if script.Parent.Parent:FindFirstChild("Handle") ~= nil and hit.Parent:FindFirstChild("Humanoid") ~= nil and game.Players:FindFirstChild(humanoid.Parent.Name):IsInGroup(72321) == true then
hit.Parent.Humanoid.Health = hit.Parent.Humanoid.MaxHealth
wait(2)
end

script.Parent.Parent.Touched:connect(onTouch)
Report Abuse
Xnite515 is not online. Xnite515
Joined: 18 Feb 2011
Total Posts: 22763
19 Sep 2011 03:46 PM
Do I put the script in the gun handle?
Report Abuse
Nagaris is not online. Nagaris
Joined: 18 Sep 2011
Total Posts: 422
19 Sep 2011 03:48 PM
well... I didn't exactly know what the script was in.. That would work though... if the variables were assigned properly.
Report Abuse
Xnite515 is not online. Xnite515
Joined: 18 Feb 2011
Total Posts: 22763
19 Sep 2011 03:50 PM
I'll test it.
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