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

Script Will Play Animation but animation does not do the right thing...?

Asked by
LuaDLL 253 Moderation Voter
6 years ago

GIF: https://gyazo.com/aec7f0f8ec266b213ff10f3dd463dde8

Script:

----- Variables
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Tool = script.Parent
local animation = script:WaitForChild("SwingAnim")
local CanSwing = true
local Swinging = false

local Settings = {
    SwingTime = 0.5,
    Damage = 15,
}

----- Functions
Tool.Activated:Connect(function()
    if CanSwing then
        Swinging = true
        print("Activated")
        local animtrack = Character:WaitForChild("Humanoid"):LoadAnimation(animation)
        animtrack:Play()
        CanSwing = false
        Tool.Handle.Touched:Connect(function(hit)
            if game.Players:GetPlayerFromCharacter(hit.Parent) then
                Tool:WaitForChild("R"):FireServer("Hit",hit.Parent,Settings.Damage)
            end
        end)
        wait(Settings.SwingTime)
        CanSwing = true
        Swinging = false
    end
end)

1 answer

Log in to vote
0
Answered by 6 years ago

I can't find an error in your script, but someone else may. It seems to me that it may be an issue with your animation. Try and go into editor and make sure everything is correct there?

0
It works perfectly in the editor and nothing is wrong with it idk why it isn't working LuaDLL 253 — 6y
Ad

Answer this question