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: the lines after "wait (3)" dont execute....

Previous Thread :: Next Thread 
hugthefatman1 is not online. hugthefatman1
Joined: 06 Sep 2012
Total Posts: 1333
26 Sep 2013 01:15 PM
so im making a button that when you step on it it opens the door for three seconds then closes. it opens the door alright, but i tdoesnt close after 3 seconds... here it is...

door1 = Workspace.door1
local enabled = true
Workspace.pp1.Touched:connect(function(hit)
if hit.Parent and game.Players:GetPlayerFromCharacter(hit.Parent) and enabled == true then
door1.Transparency = 1
door1.cancollide = false
wait (3)
door1.Transparency = 0
door1.cancollide = true
end
end)
Report Abuse
brinkokevin is not online. brinkokevin
Joined: 25 Jul 2012
Total Posts: 1673
26 Sep 2013 01:23 PM
door1 = Workspace.door1
local enabled = true
Workspace.pp1.Touched:connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid")and enabled then
enabled = false
door1.Transparency = 1
door1.CanCollide = false
wait (3)
door1.Transparency = 0
door1.CanCollide = true
enabled = true
end
end)
Report Abuse
xWOWZABOYx is not online. xWOWZABOYx
Joined: 05 Aug 2010
Total Posts: 2689
26 Sep 2013 02:10 PM
Huge, I know why. You had a space between "wait" and your opening bracket. Don't do that.

Fixed:

door1 = Workspace.door1
local enabled = true
Workspace.pp1.Touched:connect(function(hit)
if hit.Parent and game.Players:GetPlayerFromCharacter(hit.Parent) and enabled == true then
door1.Transparency = 1
door1.cancollide = false
wait(3)
door1.Transparency = 0
door1.cancollide = true
end
end)

【◄[ϟ]〓☜✪ xWOWZABOYx; FCOM, SQN COM, Scientist, Veteran, Visionary ✪☞〓[ϟ]►】
Report Abuse
takecover is not online. takecover
Joined: 19 Jun 2009
Total Posts: 407
26 Sep 2013 03:03 PM
Got the capitalization of CanCollide wrong.
Report Abuse
xWOWZABOYx is not online. xWOWZABOYx
Joined: 05 Aug 2010
Total Posts: 2689
26 Sep 2013 03:32 PM
Okay, totally fixed version:

door1 = Workspace.door1
local enabled = true
Workspace.pp1.Touched:connect(function(hit)
if hit.Parent and game.Players:GetPlayerFromCharacter(hit.Parent) and enabled == true then
door1.Transparency = 1
door1.CanCollide = false
wait(3)
door1.Transparency = 0
door1.CanCollide = true
end
end)

【◄[ϟ]〓☜✪ xWOWZABOYx; FCOM, SQN COM, Scientist, Veteran, Visionary ✪☞〓[ϟ]►】
Report Abuse
digpoe is not online. digpoe
Joined: 02 Nov 2008
Total Posts: 9092
26 Sep 2013 03:51 PM
xWOWZABOYx, you can have spaces after functions and the calls for them.

Lua allows you to write your scripts almost vertically.
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