makerror
|
  |
| Joined: 29 Aug 2011 |
| Total Posts: 493 |
|
|
| 17 Jul 2013 12:47 PM |
| How to make an event which repeats when I click mouse button1Down and hold that button, until mouse button1Up? |
|
|
| Report Abuse |
|
|
Zkiller11
|
  |
| Joined: 25 Aug 2009 |
| Total Posts: 2914 |
|
|
| 17 Jul 2013 01:03 PM |
| Make a while true do loop onbutton1down, and change the true variable to false onbutton1up. |
|
|
| Report Abuse |
|
|
makerror
|
  |
| Joined: 29 Aug 2011 |
| Total Posts: 493 |
|
|
| 17 Jul 2013 01:12 PM |
I tried this
enabled = true
local tool = script.Parent tool.Equipped:connect(function(mouse) local user = tool.Parent mouse.Button1Down:connect(function() while enabled do ray = Ray.new(tool.Handle.Position,(mouse.Hit.p - tool.Handle.Position).unit * 300) hit, position = game.Workspace:FindPartOnRay(ray, user) distance = (position - tool.Handle.Position).magnitude --------- laser = Instance.new("Part",game.Workspace) laser.Anchored = true laser.CanCollide = false laser.BrickColor = BrickColor.random() laser.Name = "Laser" laser.FormFactor = Enum.FormFactor.Custom laser.Size = Vector3.new(0.2,0.2,distance) laser.CFrame = CFrame.new(position, tool.Handle.Position) * CFrame.new(0,0,-distance/2) --------- game:GetService("Debris"):AddItem(laser, 1) wait(0.1) end mouse.Button1Up:connect(function() enabled = false end) end) end)
What's the problem? |
|
|
| Report Abuse |
|
|
|
| 17 Jul 2013 01:16 PM |
value = "Up"
DOWNEVENT(FUNCTIONSTUFF value = "Down" while value = down GJKRWJKFEW end end )
UPEVENT(FUNCTIONSTUFF value = "Up" end ) |
|
|
| Report Abuse |
|
|
|
| 17 Jul 2013 01:17 PM |
*while value = "Down" do
lolsrrybro |
|
|
| Report Abuse |
|
|
Zkiller11
|
  |
| Joined: 25 Aug 2009 |
| Total Posts: 2914 |
|
|
| 17 Jul 2013 01:17 PM |
enabled = true
local tool = script.Parent tool.Equipped:connect(function(mouse) local user = tool.Parent mouse.Button1Down:connect(function()
while enabled do wait() mouse.Button1Up:connect(function()
enabled = false end) ray = Ray.new(tool.Handle.Position,(mouse.Hit.p - tool.Handle.Position).unit * 300) hit, position = game.Workspace:FindPartOnRay(ray, user) distance = (position - tool.Handle.Position).magnitude --------- laser = Instance.new("Part",game.Workspace) laser.Anchored = true laser.CanCollide = false laser.BrickColor = BrickColor.random() laser.Name = "Laser" laser.FormFactor = Enum.FormFactor.Custom laser.Size = Vector3.new(0.2,0.2,distance) laser.CFrame = CFrame.new(position, tool.Handle.Position) * CFrame.new(0,0,-distance/2) --------- game:GetService("Debris"):AddItem(laser, 1) wait(0.1) end
mouse.Button1Up:connect(function()
enabled = false end) end) end)
Try that. |
|
|
| Report Abuse |
|
|
makerror
|
  |
| Joined: 29 Aug 2011 |
| Total Posts: 493 |
|
|
| 17 Jul 2013 01:45 PM |
| with value it worked, thanks |
|
|
| Report Abuse |
|
|