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: Too many clones.

Previous Thread :: Next Thread 
fefi_fofum is not online. fefi_fofum
Joined: 04 May 2016
Total Posts: 503
15 Jun 2016 07:04 PM
local match = script.Parent
local f = Instance.new("Fire")
f.Size = 1
f.Heat = 1
local debounce = false
match.Equipped:connect(function(mouse)
if debounce == false then
debounce = true
local target = mouse.Target
while true do
wait()
if mouse.Target == nil then
return
elseif mouse.Target == workspace.Light then
mouse.Button1Down:connect(function()
f:Clone().Parent = match.Part
end)
end
end
end
debounce = false
end)


This clones fire too many times. Does someone know why?
Report Abuse
fefi_fofum is not online. fefi_fofum
Joined: 04 May 2016
Total Posts: 503
15 Jun 2016 07:12 PM
I switched the debounce.

local match = script.Parent
local f = Instance.new("Fire")
f.Size = 1
f.Heat = 1
match.Equipped:connect(function(mouse)
local target = mouse.Target
while true do
wait()
if mouse.Target == nil then
return
elseif mouse.Target == workspace.Light then
local debounce = false
mouse.Button1Down:connect(function()
if debounce == false then
debounce = true
f:Clone().Parent = match.Part
end
debounce = false
end)
end
end
end)
Report Abuse
KillerKyle is not online. KillerKyle
Joined: 29 Jul 2007
Total Posts: 6371
15 Jun 2016 07:13 PM
It looks like you 'while true do' loop is endlessly firing the function. Maybe add a break after it fires the clone function?
Report Abuse
fefi_fofum is not online. fefi_fofum
Joined: 04 May 2016
Total Posts: 503
15 Jun 2016 07:15 PM
break requires a for loop
Report Abuse
fefi_fofum is not online. fefi_fofum
Joined: 04 May 2016
Total Posts: 503
15 Jun 2016 07:19 PM
oh lol Im just using enabled and disabled duh.
Report Abuse
KillerKyle is not online. KillerKyle
Joined: 29 Jul 2007
Total Posts: 6371
15 Jun 2016 07:20 PM
break will stop a while true do loop as well.
Report Abuse
Borsy is not online. Borsy
Joined: 31 Jul 2014
Total Posts: 15111
15 Jun 2016 07:59 PM
break breaks any loop, that is while, repeat, for,


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