| |
|
Funse
|
  |
| Joined: 11 Jun 2012 |
| Total Posts: 7887 |
|
|
| 27 Dec 2014 07:01 PM |
local sp = script.Parent
local enabled = false sp.Touched:connect(function(hit) if enabled == false then enabled = true local char = hit.Parent local hum = char:FindFirstChild("Humanoid") local torso = char:FindFirstChild("Torso") torso.Color = Color3.new(math.random(), math.random(), math.random()) enabled = false end)
|
|
|
| Report Abuse |
|
|
Tripane
|
  |
| Joined: 03 Jun 2011 |
| Total Posts: 11432 |
|
|
| 27 Dec 2014 07:02 PM |
replace torso.Color with
torso.BrickColor = BrickColor.Random() |
|
|
| Report Abuse |
|
|
| |
|
| |
|
Funse
|
  |
| Joined: 11 Jun 2012 |
| Total Posts: 7887 |
|
|
| 27 Dec 2014 07:04 PM |
If you're talking to me, you're a super scrub, and you'll stay a super scrub until you learn what a debounce is. |
|
|
| Report Abuse |
|
|
| |
|
Funse
|
  |
| Joined: 11 Jun 2012 |
| Total Posts: 7887 |
|
|
| 27 Dec 2014 07:05 PM |
Doesn't mean there isn't a debounce :/ (Which there is) |
|
|
| Report Abuse |
|
|
| |
|
| |
|
Funse
|
  |
| Joined: 11 Jun 2012 |
| Total Posts: 7887 |
|
|
| 27 Dec 2014 07:12 PM |
That's not what a debounce is :/
local sp = script.Parent local enabled = false local scrubs = {}
function checkscrub(scrub) local chuck = nil for i,v in pairs(scrubs) do if v == scrub then chuck = true end end if chuck == true then return false else return true table.insert(scrubs,scrub) end end
sp.Touched:connect(function(hit) if enabled == false then enabled = true if checkscrub(hit.Parent.Name) then local char = hit.Parent local hum = char:FindFirstChild("Humanoid") local torso = char:FindFirstChild("Torso") torso.Color = Color3.new(math.random(), math.random(), math.random()) end enabled = false end) |
|
|
| Report Abuse |
|
|
Funse
|
  |
| Joined: 11 Jun 2012 |
| Total Posts: 7887 |
|
|
| 27 Dec 2014 07:15 PM |
"My script is supposed to change the torso color once, when it is touched" :/ Learn how to use more context. |
|
|
| Report Abuse |
|
|
| |
|
|
| 27 Dec 2014 08:04 PM |
| You're both somewhat right. A debounce is a component that limits the inputs, since a small difference in, let's say pressure - for a button, could cause multiple signals to pass through a circuit, through what was (mostly) one press. Anyhow, we just call it debounce here in Roblox because it is somewhat the same concept. |
|
|
| Report Abuse |
|
|