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: debouncing problems

Previous Thread :: Next Thread 
hboogy101 is not online. hboogy101
Joined: 10 Apr 2011
Total Posts: 1392
20 Feb 2016 08:08 AM
a = 6.93
debounce = true

local part = script.Parent
part.Touched:connect(debounce(function(hit)
if hit.Parent then
local hum = hit.Parent:findFirstChild('Humanoid')
if hum then
script.Parent.CFrame = CFrame.new (4, 6.93, 3.93)
wait(0.1)
script.Parent.CFrame = CFrame.new (4, 7, 3.93)
wait(0.1)
script.Parent.CFrame = CFrame.new (4, 7.1, 3.93)
wait(0.1)
script.Parent.CFrame = CFrame.new (4, 7.2, 3.93)
wait(0.1)
script.Parent.CFrame = CFrame.new (4, 7.3, 3.93)
wait(0.1)
script.Parent.CFrame = CFrame.new (4, 7.4, 3.93)
wait(0.1)
script.Parent.CFrame = CFrame.new (4, 7.5, 3.93)
wait(0.1)
script.Parent.CFrame = CFrame.new (4, 7.6, 3.93)
wait(0.1)
script.Parent.CFrame = CFrame.new (4, 7.7, 3.93)
wait(0.1)
script.Parent.CFrame = CFrame.new (4, 7.8, 3.93)
wait(0.1)
script.Parent.CFrame = CFrame.new (4, 7.9, 3.93)
wait(0.1)
script.Parent.CFrame = CFrame.new (4, 8, 3.93)

if script.Parent.CFrame == CFrame.new (4, 6.93, 3.93) then
debounce = true
end

if script.Parent.CFrame == CFrame.New (4, 8, 3.93) then
debounce = false
end

end
end
end))




the part never rises once I get on it, is the debounce too true, is there any problems with this code?


PLEASE TELL ME
Report Abuse
hboogy101 is not online. hboogy101
Joined: 10 Apr 2011
Total Posts: 1392
20 Feb 2016 08:10 AM
why do I need that a = 6.93

im removing that from script though
Report Abuse
oni0n is not online. oni0n
Joined: 04 Nov 2012
Total Posts: 2975
20 Feb 2016 08:14 AM
the inefficiency in this one is intense..
here's something that *miiight* just work:

local debounce = false
local part = script.Parent
part.Touched:connect(function(hit)
if hit.Parent then
local hum = hit.Parent:findFirstChild("Humanoid")
end
if hum then
for i = 6.93, 8, 0.1 do
wait(0.1)
script.Parent.CFrame = CFrame.new(4, i, 3.93)
end
end
end
if script.Parent.CFrame == CFrame.new(4, 6.93, 3.93) then
debounce = true
end



#code cout << "Proof by analogy is fraud." << endl; //Bjarne Stroustrup
Report Abuse
hboogy101 is not online. hboogy101
Joined: 10 Apr 2011
Total Posts: 1392
20 Feb 2016 08:18 AM
*diidn'ttt* just work
Report Abuse
ElectoStriking is not online. ElectoStriking
Joined: 10 May 2014
Total Posts: 1547
20 Feb 2016 08:21 AM
btw his isnt any less efficient, its just not as readable, im not the only one who disagrees, check this out if you dont believe me

http://forum.roblox.com/Forum/ShowPost.aspx?PostID=180824440



#Strikin'
Report Abuse
oni0n is not online. oni0n
Joined: 04 Nov 2012
Total Posts: 2975
20 Feb 2016 08:22 AM
at least paste in what the output returned, you nimrod



#code cout << "Truth shall sit upon the lips of a dying man" << endl; //Matthew Arnold
Report Abuse
hboogy101 is not online. hboogy101
Joined: 10 Apr 2011
Total Posts: 1392
20 Feb 2016 08:24 AM
okay misterobvious-- I MEAN oni0n
Report Abuse
oni0n is not online. oni0n
Joined: 04 Nov 2012
Total Posts: 2975
20 Feb 2016 08:24 AM
@electro

his code is literally making a part go upwards at an increment of 0.1 studs.. and instead of using a for loop (for variable = pointA, pointB, increment), he's copy-pasting each line and editing the X-axis

if you don't think that's inefficient, rather unreadable, i think you should go worship cnt as your god



#code cout << "Truth shall sit upon the lips of a dying man" << endl; //Matthew Arnold
Report Abuse
hboogy101 is not online. hboogy101
Joined: 10 Apr 2011
Total Posts: 1392
20 Feb 2016 08:30 AM
hey copy pasting is fun

I think its better than

a = 3

repeat
game.Workspace.Part.Position = Vector3.new (1,3,3)
wait(.01)
a=a+.05
until game.Workspace.Part.Position = Vector3.new (1,10,3)

something like that
Report Abuse
ElectoStriking is not online. ElectoStriking
Joined: 10 May 2014
Total Posts: 1547
20 Feb 2016 08:30 AM
a = 6.93
debounce = true

local part = script.Parent
part.Touched:connect(debounce(function(hit)
if debounce then
if hit.Parent then
local hum = hit.Parent:findFirstChild('Humanoid')
if hum then
local co = coroutine.create(function()
script.Parent.Changed:connect(function()
if script.Parent.CFrame == CFrame.new(4,a,3.93) then
debounce = true
elseif script.Parent.CFrame == CFrame.new(4, 8, 3.93) then
debounce = false
end
end)
coroutine.resume(co)
script.Parent.CFrame = CFrame.new(4,a,3.93)
repeat
script.Parent.CFrame = script.Parent.CFrame * CFrame.new(0,0.1,0)
wait(0.1)
until script.Parent.CFrame = CFrame.new(4,8,2.93)
end
end
end

try that, don't come saying it doesnt work b4 you dont tweak it.



#Strikin'
Report Abuse
hboogy101 is not online. hboogy101
Joined: 10 Apr 2011
Total Posts: 1392
20 Feb 2016 08:31 AM
lol jk I just did the copy-paste for fun
Report Abuse
uknowdudes is not online. uknowdudes
Joined: 10 Jan 2011
Total Posts: 993
20 Feb 2016 08:33 AM
:/

E = MC^2/Energy = Mass x 300,00km/s^2
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