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
|
  |
| Joined: 06 Aug 2011 |
| Total Posts: 659 |
|
|
| 18 Jul 2017 12:35 AM |
Because wait is after brickcolor put it before brickcolor |
|
|
| Report Abuse |
|
|
|
| 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
|
  |
| Joined: 29 May 2014 |
| Total Posts: 18 |
|
| |
|
|
| 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
|
  |
| Joined: 29 May 2014 |
| Total Posts: 18 |
|
|
| 18 Jul 2017 12:42 AM |
| Yup. Try it. It changes brick color instantly. |
|
|
| Report Abuse |
|
|
|
| 18 Jul 2017 12:44 AM |
| it does work, restart studio or something lmao |
|
|
| Report Abuse |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 18 Jul 2017 01:02 AM |
| Maybe you should add a debounce? |
|
|
| Report Abuse |
|
|
|
| 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
|
  |
| Joined: 29 May 2014 |
| Total Posts: 18 |
|
| |
|