|
| 26 Jan 2017 11:50 AM |
Basically what im trying to do is differentiate between when the mouse is held down and when it is clicked. Inside the renderstepped function I detect if the mouse is being held down, but it seems kind of a dodgy way of doing it, also alot of problems do occur, e.g when the player is spamming mouseclick.
So does anyone have better ideas of doing it. Script:
spawn(function() mouse.Button1Up:connect(unprinted) <-sets disabled to true mouse.Button1Down:connect(printed) <-sets disabled to false end)
game:GetService("RunService").RenderStepped:connect(function() if start == false then if disabled == false and equip == true then local anim = tool:FindFirstChild("ThrowCharge") wait(.4) if disabled == false and equip == true then wait(.4) if disabled == false and equip == true then wait(.4) if disabled == false and equip == true then --code end end end end end end) |
|
|
| Report Abuse |
|
|
|
| 26 Jan 2017 11:54 AM |
why are you using spawn for events? events do NOT pause the script
Downgrading STF // https://www.roblox.com/Trade/TradeWindow.aspx?TradePartnerID=6163444 |
|
|
| Report Abuse |
|
|
|
| 26 Jan 2017 12:01 PM |
| Okay removed it, so is there a better way? |
|
|
| Report Abuse |
|
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 26 Jan 2017 12:06 PM |
player = game.Players.LocalPlayer mouse = player:GetMouse() status = "up"
mouse.Button1Down:connect(function() status = "down" while status == "down" do print("button 1 is being held down") wait() end end)
mouse.Button1Up:connect(function() status = "up" print("mouse was released") end)
|
|
|
| Report Abuse |
|
|
|
| 26 Jan 2017 12:09 PM |
| Tried that, but it wont work for what Im trying to do... |
|
|
| Report Abuse |
|
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 26 Jan 2017 12:19 PM |
Why not just use Button1Click?
|
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 26 Jan 2017 12:24 PM |
local tool = script.Parent local anim = tool:WaitForChild('ThrowCharge') local player = game.Players.LocalPlayer local mouse = player:GetMouse() local equipped,down
mouse.Button1Down:connect(function() down = true while equipped and down do --do stuff wait() end end)
mouse.Button1Up:connect(function() down = false end)
tool.Equipped:connect(function() equipped = true end)
tool.Unequipped:connect(function() equipped = false end)
|
|
|
| Report Abuse |
|
|
|
| 26 Jan 2017 12:24 PM |
local hasReleased = false local isDrag = false mouse.Button1Down:connect(function() isDrag = false hasReleased = false wait(.5) if not hasReleased then isDrag = true while not hasReleased do --code here wait() end end end)
mouse.Button1Up:connect(function() hasReleased = true end) |
|
|
| Report Abuse |
|
|
|
| 26 Jan 2017 12:24 PM |
No such function of mouse :P
http://wiki.roblox.com/index.php?title=API:Class/Mouse |
|
|
| Report Abuse |
|
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
| |
|
|
| 26 Jan 2017 12:26 PM |
| Nvm ill try and get it to work with a while loop |
|
|
| Report Abuse |
|
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 26 Jan 2017 12:28 PM |
Use any of the three methods we posted above, they're all basically the same.
|
|
|
| Report Abuse |
|
|
|
| 26 Jan 2017 04:59 PM |
button1click doesnt exist because its intended for guis only button1click basically makes sure u pressed on the button and released on the button
Downgrading STF // https://www.roblox.com/Trade/TradeWindow.aspx?TradePartnerID=6163444 |
|
|
| Report Abuse |
|
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 26 Jan 2017 05:18 PM |
yeah after 4s of looking at the wiki I gathered that
|
|
|
| Report Abuse |
|
|