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
 

Why doesn't this work?

Previous Thread :: Next Thread 
bobboy7797 is not online. bobboy7797
Joined: 06 Oct 2008
Total Posts: 40
15 Jul 2011 11:56 AM
function onTouch(hit)
if hit.Parent IsInGroup(159511) then
script.Parent.CanCollide = false
wait(2)
script.Parent.CanCollide = true
end
end
script.Parent.Touched:connect(onTouch)

it is a group door, but it doesn't work.

The output says : 'then' expected near 'IsInGroup'

what is wrong with it?
Report Abuse
buildthomas is not online. buildthomas
Joined: 05 Dec 2008
Total Posts: 715
15 Jul 2011 11:57 AM
"if hit.Parent IsInGroup(159511) then"

Firstly, it would be hit.Parent:IsInGroup(159511)

Secondly, you dont know if hit.Parent is not nil, and you dont know if its a character.

Thirdly, IsInGroup() method is only used on the Player object, not the Model object.
Report Abuse
chikenugget is not online. chikenugget
Joined: 09 May 2009
Total Posts: 2552
15 Jul 2011 12:00 PM
function onTouch(hit)
plr = game.Players:findFirstChild(hit.Parent.Name)
if plr then
if plr:IsInGroup(159511) then
script.Parent.CanCollide = false
wait(2)
script.Parent.CanCollide = true
end
end
end
script.Parent.Touched:connect(onTouch)

Report Abuse
buildthomas is not online. buildthomas
Joined: 05 Dec 2008
Total Posts: 715
15 Jul 2011 12:01 PM
function onTouch(hit)
if hit.Parent~=nil then
plr = game.Players:findFirstChild(hit.Parent.Name)
if plr then
if plr:IsInGroup(159511) then
script.Parent.CanCollide = false
wait(2)
script.Parent.CanCollide = true
end
end
end
end
script.Parent.Touched:connect(onTouch)

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