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: OP Scripters Help ME!!

Previous Thread :: Next Thread 
Nicoehh is not online. Nicoehh
Joined: 18 Nov 2014
Total Posts: 119
05 Dec 2016 10:01 AM
Ok so I need help how do I play an animation when you have some tool equipped and press some key like "Q" ?
Report Abuse
darkjediwarriorX is online. darkjediwarriorX
Joined: 26 Aug 2015
Total Posts: 879
05 Dec 2016 10:05 AM
--In the tool, as a Script

function UseKey(key)
if key == "q" then
local anim = script.Parent.Parent.Humanoid:LoadAnimation(script.Parent.Animation)
--Put the animation in the tool
anim:Play()
end
end

script.Parent.Equipped:connect(function(mouse)
mouse.KeyDown:connect(UseKey)
end)
Report Abuse
VioXz is not online. VioXz
Joined: 12 May 2014
Total Posts: 12
05 Dec 2016 10:06 AM
^ no use UserInputService


- OnlySinister
Report Abuse
darkjediwarriorX is online. darkjediwarriorX
Joined: 26 Aug 2015
Total Posts: 879
05 Dec 2016 10:07 AM
It doesn't matter.
Report Abuse
Nicoehh is not online. Nicoehh
Joined: 18 Nov 2014
Total Posts: 119
05 Dec 2016 10:12 AM
It didn't work for me, but thanks for reply.
Report Abuse
darkjediwarriorX is online. darkjediwarriorX
Joined: 26 Aug 2015
Total Posts: 879
05 Dec 2016 10:15 AM
did you put it into a tool? with an animation? Post the Error from the Output.
Report Abuse
Nicoehh is not online. Nicoehh
Joined: 18 Nov 2014
Total Posts: 119
05 Dec 2016 10:29 AM
There is no error in output and yes I had the animation in tool!
Report Abuse
xXLuka_XD is not online. xXLuka_XD
Joined: 27 Mar 2016
Total Posts: 296
05 Dec 2016 11:03 AM
Key Down doesn't work perfect for everyone. Suggest using UserInputService
Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
05 Dec 2016 12:26 PM
"It doesn't matter."

You're a moron if you have that kind of attitude.


Report Abuse
Nicoehh is not online. Nicoehh
Joined: 18 Nov 2014
Total Posts: 119
05 Dec 2016 12:26 PM
Any examples?
Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
05 Dec 2016 12:27 PM
--local script

local uis = game:GetService('UserInputService')

uis.InputBegan:connect(function(input,event)
if input.KeyCode == Enum.KeyCode.Q then
--load animation
end
end)


Report Abuse
spinywind is online. spinywind
Joined: 26 Jan 2012
Total Posts: 3580
05 Dec 2016 01:59 PM
^ Do what time ticks did, dont listen to dark. UserInputService is a lot better.=, keydown/up is deprecated.


#Code print(print(print(print(print(print(print())))))))
Report Abuse
Nicoehh is not online. Nicoehh
Joined: 18 Nov 2014
Total Posts: 119
05 Dec 2016 06:11 PM
It still doesn't play the anim. By the way this is for a tool so :P
Report Abuse
SirTipsAlot is not online. SirTipsAlot
Joined: 08 Feb 2012
Total Posts: 2431
05 Dec 2016 06:17 PM
did you load the animation


Report Abuse
Roblok1 is online. Roblok1
Joined: 27 Jul 2011
Total Posts: 2019
05 Dec 2016 06:34 PM
anim = humanoid:LoadAnimation (tool.animation)
anim:Play ()
Report Abuse
darkjediwarriorX is online. darkjediwarriorX
Joined: 26 Aug 2015
Total Posts: 879
07 Dec 2016 08:53 AM
Well Non-Existant Christ, ya don't gotta be that rude to me, I'm so sorry for being an Old Timer.
Report Abuse
jmbooth is not online. jmbooth
Joined: 10 Oct 2012
Total Posts: 13
07 Dec 2016 09:03 AM
Tool = script.Parent
equipped = false
local UIP = game:GetService('UserInputService')

Tool.Equipped:connect(function()
equipped = true
end)

Tool.unequipped:connect(function()
equipped = false
end)

UIP.InputBegan:connect(function(input)
if UIP:GetFocusedTextBox() == nil then
if input.KeyCode == Enum.KeyCode.Q and equipped then
--animationscript here
end
end
end)


Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
07 Dec 2016 09:05 AM
@jm

if not event then return end

why would anyone do getfocusedtextbox. gross


Report Abuse
jmbooth is not online. jmbooth
Joined: 10 Oct 2012
Total Posts: 13
07 Dec 2016 09:07 AM
So it doesn't work when chatting


Report Abuse
jmbooth is not online. jmbooth
Joined: 10 Oct 2012
Total Posts: 13
07 Dec 2016 09:10 AM
UIP.InputBegan:connect(function(input)
if input.KeyCode ~= Enum.KeyCode.Q and not equipped then

elseif onput.KeyCode == Enum.KeyCode.Q and equipped then
--animation script here
end
end)


Report Abuse
jmbooth is not online. jmbooth
Joined: 10 Oct 2012
Total Posts: 13
07 Dec 2016 09:10 AM
input*


Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
07 Dec 2016 09:14 AM
yes like i said

uis.InputBegan:connect(function(input,event)
if event then return end --if player is chatting


Report Abuse
HlCOM is not online. HlCOM
Joined: 29 Mar 2009
Total Posts: 3332
07 Dec 2016 09:15 AM
if you're gonna tell someone to use something that's deprecated then you shouldn't be posting advice.
Report Abuse
darkjediwarriorX is online. darkjediwarriorX
Joined: 26 Aug 2015
Total Posts: 879
07 Dec 2016 09:23 AM
UserInputService isn't deprecated.
Report Abuse
Lykaon is not online. Lykaon
Joined: 27 Oct 2014
Total Posts: 784
07 Dec 2016 09:24 AM
Remove is deprecated, use script.Parent = nil instead.
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