Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How would I script an animation to work via the key binds T + Click on person?

I have a telekineis push animation that I want to add to my game but I do not know how to script it so the key binds are T + Click on Playe you want to use it on This is the animation to show what I mean: https://www.youtube.com/watch?v=rinRVGumuQk I want this to be able to used on other players not just something for the dummys to use.

2 comments

0

Is the ability available for all the players?

0

@NathanBlox_Studios Yes the ability is for everyone.

2 answers

insert a local script into startercharacterscripts then paste this

local player = game.Players.LocalPlayer
repeat wait() until player.Character.Humanoid
local humanoid = player.Character.Humanoid
local mouse = player:GetMouse()


local anim = Instance.new("Animation")
anim.AnimationId = "http://www.roblox.com/asset/?id='' --  add your animation id

mouse.KeyDown:connect(function(key)
  if key == "t" then
   local playAnim = humanoid:LoadAnimation(anim)
   playAnim:Play()

    end
end)

accept this answer* if it helped!

1 comment

0

Sorry this didn't work for me @RareBlue the script didn't work :/

local player = game.Players.LocalPlayer
local char = player.Character
local humanoid = char.Humanoid
local mouse = player:GetMouse()
local UIS = game:GetService("UserInputService")

local track = instance.New("Animation")
track.AnimationId = "http://www.roblox.com/asset/?id=' '

UIS.InputBegan:connect(function(Input)
    local MouseInput = Input.UserInputType -- Get all mouse inputs
    local KeyCode = Input.KeyCode -- Get all keyboard inputs
    
    if MouseInput = Enum.UserInputType.MouseButton1 then
		if KeyCode = Enum.KeyCode.T then
			if mouse.Target ~= nil and mouse.Target.Name = ' ' then --humanoid or player,character			
				local = trackPlay = humanoid:LoadAnimation(track)	
				trackPlay:Play()


you're gonna have to define player, character, etc., assuming you know how.

1 comment

0

@localMeems I wish I knew how to do that but uh I don't actually know how because I am completely clueless when it comes to scripting LOL

This discussion is preserved as it was. New answers, comments, and votes are closed.