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

Problem with stand playing animation?

Asked by 2 years ago
Edited 2 years ago

Basically, I made a stand lean animation and instead of working, it look like this: https://ibb.co/rH5JHJ6 My problem is that the animation is not playing correctly Help please My scripts: Summon:

local tween = game:GetService("TweenService")

function summon(player)
    repeat wait() until player.Data.Stand.Value ~= ""
    local chr = player.Character
    if not chr:FindFirstChild("Stand") then 
        local stand = game.ServerStorage.StandModels:FindFirstChild(player.Data.Stand.Value)
        if stand then
            local us = stand:Clone()
            us.Name = "Stand"
            us.Parent = player.Character
            for i,v in pairs(us:GetDescendants()) do
                if v:IsA("BasePart") then
                    local pr = v.Transparency
                    v.Transparency = 1
                    tween:Create(v,TweenInfo.new(.7,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut),{Transparency = pr}):Play()
                elseif v:IsA("ParticleEmitter") then v:Emit(1.3)
                end
            end

            local animcon = Instance.new("AnimationController",us)
            animcon.Name = "AnimControl"
            animcon:LoadAnimation(us.HumanoidRootPart.Idle):Play()
            local weld = Instance.new("ManualWeld",us.HumanoidRootPart)
            weld.Name = "s2c"
            weld.Part0 = weld.Parent
            weld.Part1 = chr.PrimaryPart
            require(game.ReplicatedStorage.Modules.Scripts.MainModule).StandPos(weld,0,0,0,0)
            require(game.ReplicatedStorage.Modules.Scripts.MainModule).StandPos(weld,-2,.3,2,.5)
        end
    elseif chr:FindFirstChild("Stand") then
        for i,v in pairs(chr.Stand:GetDescendants()) do
            if v:IsA("BasePart") or v:IsA("Decal") then
                tween:Create(v,TweenInfo.new(.6),{Transparency=1}):Play()
            elseif v:IsA("ParticleEmitter") then v:Emit(1.3)
            end
        end
        require(game.ReplicatedStorage.Modules.Scripts.MainModule).StandPos(chr.Stand.HumanoidRootPart.s2c,0,0,0,.5)
        wait(.5)
        chr.Stand:Destroy()
    end
end

game.ReplicatedStorage.Events.Moves.Summon.OnServerEvent:Connect(summon)

Stand Lean:

local player = game:GetService("Players").LocalPlayer
local Character = player.Character or player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")
local Stand = script.Parent
local AnimControl = Stand:WaitForChild("AnimControl")
local AnimTable = {
    ["Front"] = AnimControl:LoadAnimation(script:WaitForChild("Front"));
}
for i , v in pairs(AnimTable) do
    v:Play()
end
local function setweight(anim,weight)
    weight = weight --+ 0.001
    anim:AdjustWeight(weight)
end
game:GetService("RunService").RenderStepped:Connect(function()
    if Humanoid.MoveDirection ~= Vector3.new(0,0,0) then
        setweight(AnimTable.Front,1)
    else 
        setweight(AnimTable.Front,0)
    end
end)
0
what's the problem Xeqro 20 — 2y
0
I guess this link is not gonna work for us, you gotta upload it to somewhere else MrSuperKrut 167 — 2y

Answer this question