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: How do I add crouch to my gun

Previous Thread :: Next Thread 
ProphetSparrow is not online. ProphetSparrow
Joined: 23 Sep 2010
Total Posts: 3574
20 Jul 2016 06:23 PM
title

halp


Report Abuse
Kodran is not online. Kodran
Joined: 15 Aug 2013
Total Posts: 5330
20 Jul 2016 06:25 PM
uis.inputbeggined {
if input.key == c or input.key == left control then
crouch the character model()
end
}
Report Abuse
ProphetSparrow is not online. ProphetSparrow
Joined: 23 Sep 2010
Total Posts: 3574
20 Jul 2016 06:30 PM
help it didnt work


Report Abuse
Kodran is not online. Kodran
Joined: 15 Aug 2013
Total Posts: 5330
20 Jul 2016 06:30 PM
should work. make it a modulescript in replicatedfirst.
Report Abuse
ProphetSparrow is not online. ProphetSparrow
Joined: 23 Sep 2010
Total Posts: 3574
20 Jul 2016 06:34 PM
still didnt work

im new to scripting


Report Abuse
Kodran is not online. Kodran
Joined: 15 Aug 2013
Total Posts: 5330
20 Jul 2016 06:35 PM
You should try to learn more basic concepts before trying to tackle something like this. Start at the wiki:

wiki.roblox.com
Report Abuse
RemasteredBox is not online. RemasteredBox
Joined: 19 Jun 2016
Total Posts: 2140
20 Jul 2016 06:42 PM
game:service'UserInputService'.InputBegan:connect(function(i,g)
if not g then
if i.UserInputType == Enum.UserInputType.Keyboard then
if i.KeyCode == Enum.KeyCode.C then
--Make them crouch
end
end
end
end)

There, I just did the hard part for you. Not that any of it is hard.
Just use a BodyForce to push them down, disable it while jumping, then reenable it .75 seconds later or so. Then animate it with ROBLOX animations.


#code print("While I may look like a cataclysmic god of the eggs from the future, I am not.")
Report Abuse
ImDgilly is not online. ImDgilly
Joined: 23 Oct 2010
Total Posts: 76
20 Jul 2016 06:58 PM
local UserInputService = game:GetService('UserInputService')

UserInputService.InputBegan:connect(function(Input, gameProcessed)

if Input.KeyCode == Enum.KeyCode.Z then

~~~ Crouch stuff here

end

end)
Report Abuse
RemasteredBox is not online. RemasteredBox
Joined: 19 Jun 2016
Total Posts: 2140
20 Jul 2016 07:00 PM
Eww that ugly white-space in the middle though Dgilly, and you forgot to make sure the input type matched.
Now I have to rewrite my crap just to beat you.

#code
game:GetService("UserInputService").InputBegan:connect(function(InputObject, GameProcessedEvent)
if (not GameProcessedEvent) then
if (InputObject.UserInputType == Enum.UserInputType.Keyboard) then
if (InputObject.KeyCode == Enum.KeyCode.C) then
--Code to crouch ere
end
end
end
end)

Same advice for crouching applies, OP. Might be a little hard to follow at first, but you'll get there.


#code print("While I may look like a cataclysmic god of the eggs from the future, I am not.")
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