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

how do i add power to an anamation like this ?

Asked by 8 years ago
Edited 8 years ago
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 = "https://www.roblox.com/item.aspx?id=487738693" -- id of animation

mouse.KeyDown:connect(function(key)
    if key == "z" then --Select a button, if you want shift then put 48 in it
        local playAnim = humanoid:LoadAnimation(anim)
        playAnim:Play()
    end
end) 

now i want to a like an aura in torso am good but not that good at scripting Please help me Thank you

0
any one deantay4 10 — 8y
0
Can you please use code block and what do you mean by power? User#5423 17 — 8y
0
ok deantay4 10 — 8y
0
there deantay4 10 — 8y
View all comments (9 more)
0
i mean like and aura or like an blast or shield or somthing like dragonballz and hunter x hunter deantay4 10 — 8y
0
You can add fire while the animation is playing as an example. User#5423 17 — 8y
0
ok how i do that deantay4 10 — 8y
0
I'le do an answer in a bit User#5423 17 — 8y
0
Are you using FE? User#5423 17 — 8y
0
am not sure deantay4 10 — 8y
0
what does FE mean deantay4 10 — 8y
0
am sorry i just dont get it deantay4 10 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago

This script will work with no filtering. Here is a better link that may help explain it in more detail FilteringEnabled

Also we can use StarterCharacterScripts for tasks involving the character as we do not need to check if the character is nil. We just wait for the contents of the character.

Lastly KeyDown is deprecated, the good news is that we have a whole new service that holds all of the users input called UserInputService.

Here is an example local script which goes into the StarterCharacterScripts:-

local humanoid = script.Parent:WaitForChild('Humanoid')
local anim = Instance.new("Animation")
anim.AnimationId = "https://www.roblox.com/item.aspx?id=487738693"
local playAnim = humanoid:LoadAnimation(anim)

local usrInpServ = game:GetService('UserInputService')

-- add fire function
local function addFire()
    local torso = script.Parent:FindFirstChild('Torso') -- finds torso
    if torso then -- if torso is found
        if not torso:FindFirstChild('fire') then -- if there is no fire we add fire
            local fire  = Instance.new('Fire', torso) -- adds fire to torso
            fire.Name = 'fire'
            fire.Heat = 0
            fire.Color = Color3.new(255/255, 0, 4/255)
            fire.Size = 12
            fire.SecondaryColor = Color3.new(255/255, 0, 4/255)
        end
    end
end

usrInpServ.InputBegan:connect(function(input, gameProcessedEvent)
    if input.UserInputType == Enum.UserInputType.Keyboard then -- input must be a keyboard
        if input.KeyCode == Enum.KeyCode.Z then -- check key press 
            playAnim:Play() -- plays animation
            addFire() -- adds fire 
        end
    end
end)

To make this work with FE you would simply need to move the add fire function to the server and fire the server to add the fire to the player.

I hope this helps as it is only an example which can be built upon such as removing the fire.

Pleas comment if you do not fully understand how / why this code works but also check the wiki page first.

0
that very helpful and i added the remove so it looks good now deantay4 10 — 8y
Ad

Answer this question