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: automatic guns that work on mobile devices

Previous Thread :: Next Thread 
legoe22 is not online. 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 is not online. 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 is not online. 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 is not online. 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
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