legoe22
|
  |
| Joined: 25 Aug 2012 |
| Total Posts: 546 |
|
|
| 21 Jul 2015 11:31 PM |
Hi i'm making automatic weapons that work on mobile devices. And i'm trying to do the scripting of starting and stoping the automatic firing.
I know in a normal gun that is automatic you would do this.
mouse.Button1Down:connect(function() start firing code here end) for making the gun shoot and
mouse.Button1Up:connect(function() stop firing code here end)
to stop the firing, How would i do the part of the script to see if a mouse or a mobile is clicked or let go?
How would i do this?
As a note. If someone can find a working, Mobile compatible automatic gun. Please send me a link of it.
Thanks
|
|
|
| Report Abuse |
|
|
instawin
|
  |
| Joined: 04 Jun 2013 |
| Total Posts: 8777 |
|
|
| 21 Jul 2015 11:38 PM |
well, i found a mobile compatible pistol made by uristmcsparks, you could find it in free models easily
but what i would do is this
local UIS = game:GetService("UserInputService") local tool = script.Parent
local platformType
if UIS.KeyboardEnabled and UIS.MouseEnabled then platformType = "computer" elseif UIS.TouchEnabled then platformType = "touch-device" end
tool.Equipped:connect(function() equipped = true if platformType == "computer" and equipped then -- code for when the player has a computer, use the mouse n stuff for your desires elseif platformType == "touch-device" and equipped then -- do stuff for when the player is using a touch device, possibly use ContextActionService or UIS depending on preference end end)
tool.Unequipped:connect(function() equipped = false end) |
|
|
| Report Abuse |
|
|
legoe22
|
  |
| Joined: 25 Aug 2012 |
| Total Posts: 546 |
|
|
| 22 Jul 2015 02:23 AM |
Thanks! Um how would i use ContextActionService or UIS
Thanks! legoe22 |
|
|
| Report Abuse |
|
|
instawin
|
  |
| Joined: 04 Jun 2013 |
| Total Posts: 8777 |
|
|
| 22 Jul 2015 02:51 AM |
look on the wiki, it provides some information regarding the services
there is also a tutorial on the wiki for ContextActionService |
|
|
| Report Abuse |
|
|