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 » Scripting Helpers
Home Search
 

Re: mouse buttons

Previous Thread :: Next Thread 
makerror is not online. 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 is not online. 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 is not online. 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
TrueSoulWolf is not online. TrueSoulWolf
Joined: 02 Apr 2011
Total Posts: 460
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
TrueSoulWolf is not online. TrueSoulWolf
Joined: 02 Apr 2011
Total Posts: 460
17 Jul 2013 01:17 PM
*while value = "Down" do

lolsrrybro
Report Abuse
Zkiller11 is not online. 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 is not online. makerror
Joined: 29 Aug 2011
Total Posts: 493
17 Jul 2013 01:45 PM
with value it worked, thanks
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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