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

How could I put a camera animation when clicking?

Asked by 6 years ago
Edited 6 years ago

Ok, so Im doing like when you click in a tool it changes of attack so there's a first attack, a second attack and a third attack and I want the camera to move around the character when it loads

anime = script.Parent.name.Value
First = "rbxassetid://1842867183" -- First animation
Second = "rbxassetid://1842896883" -- Second Animation
Third = "rbxassetid://1842925302" -- Third animation
Attack = 1 -- In wich attack it starts
-- Here I will do Camera effects

script.Parent.Selected:connect(function(m)
    print("Selected")
    m.Button1Down:connect(function()
        print("Clicked") -- To check we clicked and it works
         local hum = game.Players.LocalPlayer.Character.Humanoid
        if Attack == 1 then
            script.Parent.Animation.AnimationId = First
            local anim = hum:LoadAnimation(script.Parent.Animation)
            local current = anim
            current:Play()
            print("Anim 1 played")
            Attack =  2
        elseif Attack == 2 then
            script.Parent.Animation.AnimationId = Second
            local anim = hum:LoadAnimation(script.Parent.Animation)
            anim:Play()
            print("Anim 2 played")
            Attack = 3
        elseif Attack == 3 then
            script.Parent.Animation.AnimationId = Third
            local anim = hum:LoadAnimation(script.Parent.Animation)
            anim:Play()
            print("Anim 3 played")
            Attack = 1
        end
    end)
end)

Thanks for the help!

Answer this question