Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

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

Asked by 4 years ago

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.

0
Is the ability available for all the players? NathanBlox_Studios 212 — 4y
0
@NathanBlox_Studios Yes the ability is for everyone. Adoadmelad 5 — 4y

2 answers

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

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!

0
Sorry this didn't work for me @RareBlue the script didn't work :/ Adoadmelad 5 — 4y
Ad
Log in to vote
0
Answered by 4 years ago
Edited 4 years ago
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.

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 Adoadmelad 5 — 4y

Answer this question