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: help pls

Previous Thread :: Next Thread 
mario55j is not online. mario55j
Joined: 13 Aug 2012
Total Posts: 143
03 Jan 2016 05:50 AM
Ok so i have an Animation that I want where when you click x the animation happens

player = game.Players.LocalPlayer

mouse = player:GetMouse()

animation = script:WaitForChild("Animation")

enabled = true

mouse.KeyDown:connect(function(key)

if key == "x" then




if enabled then
enabled = false


local animationTrack = player.Character.Humanoid:LoadAnimation(animation)
animationTrack:Play()




wait(1.5)
enabled = true

end
end
end)

But there is something am confused about how do I make it so the animation keeps happening until you let go of x

thx
Report Abuse
mario55j is not online. mario55j
Joined: 13 Aug 2012
Total Posts: 143
03 Jan 2016 06:05 AM
anyone? I just want to know what I can do to that script to make it so the animation keeps on going until you let go of x
Report Abuse
CLIMAXIMUS is not online. CLIMAXIMUS
Joined: 22 Jun 2012
Total Posts: 1738
03 Jan 2016 06:08 AM
local xisdown = game.UserInputService:IsKeyDown(Enum.KeyCode.X)
Report Abuse
mario55j is not online. mario55j
Joined: 13 Aug 2012
Total Posts: 143
03 Jan 2016 06:10 AM
where do I put that or what do I change to that
Report Abuse
mario55j is not online. mario55j
Joined: 13 Aug 2012
Total Posts: 143
03 Jan 2016 06:13 AM
and It says UserInputService is not a valid member of DataModel
Report Abuse
ChiefTitan is not online. ChiefTitan
Joined: 03 Dec 2015
Total Posts: 2242
03 Jan 2016 06:31 AM
"game.UserInputService"

game:GetService("UserInputService")


Report Abuse
cody123454321 is not online. cody123454321
Joined: 21 Nov 2009
Total Posts: 5408
03 Jan 2016 06:35 AM
What you want to do is create a "thread" that repeats until you stop pressing the button and this "thread" breaks.

local looping = false

local loopAnim = function()
while(looping)do
-- put animation and delay here
end
end

game:GetService("UserInputService").InputBegan:connect(function(method)
if(method.KeyCode == Enum.KeyCode.X)then
looping = true
loopAnim()
end
end)

game:GetService("UserInputService").InputEnded:connect(function(method)
if(method.KeyCode == Enum.KeyCode.X)then
looping = false
end
end)
Report Abuse
mario55j is not online. mario55j
Joined: 13 Aug 2012
Total Posts: 143
03 Jan 2016 06:38 AM
so like this? player = game.Players.LocalPlayer

local looping = false

local loopAnim = function()
while(looping)do
http://www.roblox.com/asset?id=339025390
(1.5)
end
end

game:GetService("UserInputService").InputBegan:connect(function(method)
if(method.KeyCode == Enum.KeyCode.X)then
looping = true
loopAnim()
end
end)

game:GetService("UserInputService").InputEnded:connect(function(method)
if(method.KeyCode == Enum.KeyCode.X)then
looping = false
end
end)
Report Abuse
mario55j is not online. mario55j
Joined: 13 Aug 2012
Total Posts: 143
03 Jan 2016 06:47 AM
or do you mean like this

local looping = false

animation = script:WaitForChild("Animation")
player = game.Players.LocalPlayer


local loopAnim = function()
while(looping)do

local animationTrack = player.Character.Humanoid:LoadAnimation(animation)
animationTrack:Play()end
end

game:GetService("UserInputService").InputBegan:connect(function(method)
if(method.KeyCode == Enum.KeyCode.X)then
looping = true
loopAnim()
end
end)

game:GetService("UserInputService").InputEnded:connect(function(method)
if(method.KeyCode == Enum.KeyCode.X)then
looping = false
end
end)
Report Abuse
CLIMAXIMUS is not online. CLIMAXIMUS
Joined: 22 Jun 2012
Total Posts: 1738
03 Jan 2016 06:49 AM
i typed it quickly sorry
Report Abuse
mario55j is not online. mario55j
Joined: 13 Aug 2012
Total Posts: 143
03 Jan 2016 06:52 AM
Cody the second one just makes you get shut downed

sorry if I don't get it fast am new
Report Abuse
mario55j is not online. mario55j
Joined: 13 Aug 2012
Total Posts: 143
03 Jan 2016 06:53 AM
And the first one does not work
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