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: Debounce not working?

Previous Thread :: Next Thread 
WAATERMELON is not online. WAATERMELON
Joined: 03 Jul 2014
Total Posts: 921
27 Dec 2014 07:00 PM
[ Content Deleted ]
Report Abuse
Funse is not online. 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 is not online. Tripane
Joined: 03 Jun 2011
Total Posts: 11432
27 Dec 2014 07:02 PM
replace torso.Color with

torso.BrickColor = BrickColor.Random()
Report Abuse
WAATERMELON is not online. WAATERMELON
Joined: 03 Jul 2014
Total Posts: 921
27 Dec 2014 07:03 PM
[ Content Deleted ]
Report Abuse
WAATERMELON is not online. WAATERMELON
Joined: 03 Jul 2014
Total Posts: 921
27 Dec 2014 07:03 PM
[ Content Deleted ]
Report Abuse
Funse is not online. 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
WAATERMELON is not online. WAATERMELON
Joined: 03 Jul 2014
Total Posts: 921
27 Dec 2014 07:04 PM
[ Content Deleted ]
Report Abuse
Funse is not online. 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
WAATERMELON is not online. WAATERMELON
Joined: 03 Jul 2014
Total Posts: 921
27 Dec 2014 07:06 PM
[ Content Deleted ]
Report Abuse
WAATERMELON is not online. WAATERMELON
Joined: 03 Jul 2014
Total Posts: 921
27 Dec 2014 07:07 PM
[ Content Deleted ]
Report Abuse
Funse is not online. 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 is not online. 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
WAATERMELON is not online. WAATERMELON
Joined: 03 Jul 2014
Total Posts: 921
27 Dec 2014 07:52 PM
[ Content Deleted ]
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
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
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