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 » Scripters
Home Search
 

Re: Touched:Connect() help

Previous Thread :: Next Thread 
Cybertek is not online. Cybertek
Joined: 29 May 2014
Total Posts: 18
18 Jul 2017 12:34 AM
script.Parent.Touched:connect(function(hit)
local humanoid=hit.Parent:FindFirstChild("Humanoid")
if humanoid then
script.Parent.BrickColor=BrickColor.Random()
wait(3)
end
end)

Why does it keep changing the brick color instantly even though I've added wait(3)?
Report Abuse
kylerzong is not online. kylerzong
Joined: 06 Aug 2011
Total Posts: 659
18 Jul 2017 12:35 AM
Because wait is after brickcolor
put it before brickcolor
Report Abuse
FluoroGames is not online. FluoroGames
Joined: 18 Apr 2014
Total Posts: 92
18 Jul 2017 12:37 AM
I'm really bad at scripting, but I think the wait(3) is in the wrong place?


print(", you were just caught, script kiddie.")
Report Abuse
Cybertek is not online. Cybertek
Joined: 29 May 2014
Total Posts: 18
18 Jul 2017 12:38 AM
Same effect. Help please.
Report Abuse
XenightTII is not online. XenightTII
Joined: 09 Nov 2013
Total Posts: 3568
18 Jul 2017 12:41 AM
script.Parent.Touched:connect(function(hit)
local humanoid=hit.Parent:FindFirstChild("Humanoid")
if humanoid then
wait(3)
script.Parent.BrickColor=BrickColor.Random()
end
end)

You're saying this is not working?


Report Abuse
Cybertek is not online. Cybertek
Joined: 29 May 2014
Total Posts: 18
18 Jul 2017 12:42 AM
Yup. Try it. It changes brick color instantly.
Report Abuse
systematicaddict is not online. systematicaddict
Joined: 13 Jul 2012
Total Posts: 4188
18 Jul 2017 12:44 AM
it does work, restart studio or something lmao
Report Abuse
XenightTII is not online. XenightTII
Joined: 09 Nov 2013
Total Posts: 3568
18 Jul 2017 12:47 AM
script.Parent.Touched:connect(function(hit)
local humanoid=hit.Parent:FindFirstChild("Humanoid")
if humanoid then
wait(3)
script.Parent.BrickColor=BrickColor.Random()
end
end)

I put in this exactly it does work
You're clearly changing something


Report Abuse
Cybertek is not online. Cybertek
Joined: 29 May 2014
Total Posts: 18
18 Jul 2017 12:52 AM
Follow me I'll show you what I'm talking about.
Report Abuse
HexagonCode is not online. HexagonCode
Joined: 09 Dec 2015
Total Posts: 1216
18 Jul 2017 01:02 AM
Maybe you should add a debounce?
Report Abuse
XenightTII is not online. XenightTII
Joined: 09 Nov 2013
Total Posts: 3568
18 Jul 2017 01:03 AM
OP wanted script to have a buffer so you couldn't spam it

local debounce = true
script.Parent.Touched:connect(function(hit)
local humanoid=hit.Parent:FindFirstChild("Humanoid")
if debounce then
debounce = false
if humanoid then
wait(3)
script.Parent.BrickColor=BrickColor.Random()
debounce = true
end
end
end)


Report Abuse
Cybertek is not online. Cybertek
Joined: 29 May 2014
Total Posts: 18
18 Jul 2017 01:06 AM
Thanks.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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