即使组拥有的动画和组拥有的游戏且优先级最高,Roblox 动画也无法播放

问题描述 投票:0回答:1
  • 动画归集团所有,游戏亦归集团所有 组。
  • 我在 R6 装备上创建了动画,并且所有玩家都在 游戏是R6。
  • 优先级设置为最高(操作 4)
  • 动画ID正确
  • 动画已发布到 roblox。
  • 控制台显示正在播放。
  • 播放器没有制作动画。
local Players = game:GetService("Players")
local selectedPlayer = game:GetService('ReplicatedStorage'):WaitForChild("Events"):WaitForChild("SelectedPlayer")
local tool = script.Parent
local blade = tool:WaitForChild('Blade')
local slashAnim = tool:WaitForChild('SlashAnim')
local debounce = false
local playersHit = {}
local COOLDOWN = 1

tool.Activated:Connect(function()
    if debounce then
        return
    end

    local humanoid : Humanoid = tool.Parent:FindFirstChild("Humanoid")
    if not humanoid then
        warn("Humanoid not found in tool.Parent:", tool.Parent.Name)
        return
    end

    local animator : Animator = humanoid:FindFirstChild("Animator") or Instance.new("Animator", humanoid)
    local animTrack : AnimationTrack = animator:LoadAnimation(slashAnim)
    --animTrack:AdjustWeight(1)
    
    print(animator:GetPlayingAnimationTracks())

    repeat task.wait() until animTrack.Length > 0
    animTrack:Play()
    print("Animaion ID: ", animTrack.Animation.AnimationId)
    print("Animation Playing:", animTrack.IsPlaying)
    print("Animation Priority:", animTrack.Priority)

    debounce = true
    animTrack.Stopped:Wait() -- Wait for animation to complete
    debounce = false
end)

blade.Touched:Connect(function(hit)
    local humanoid = hit.Parent:FindFirstChild('Humanoid')

    if not humanoid or hit.Parent == tool.Parent or playersHit[hit.Parent] or not debounce then
        return
    end

    selectedPlayer:FireServer(humanoid)

    -- Prevents overloading server when player has activated tool
    playersHit[hit.Parent] = true 
    task.wait(COOLDOWN)
    playersHit[hit.Parent] = nil
end)

控制台打印此内容。

{
    [1] = ToolNoneAnim,
    [2] = Animation1,
    [3] = SlashAnim
}  -  Client - WeaponScript:25

Animaion ID:  rbxassetid://107803674678292  -  Client - WeaponScript:29
Animation Playing: true  -  Client - WeaponScript:30
Animation Priority: Enum.AnimationPriority.Action4 -  Client - WeaponScript:31
animation lua roblox
1个回答
0
投票

原来动画是用R15制作的,而我将游戏设置为仅R6,由于两种类型之间的身体部位不同,游戏无法在R6机身上播放R15动画。

我有一个误解,R6 表示该角色是块状的,R15 表示该角色不是块状的。不过只是身体部位不同而已。

R6 VS R15 块状人物图片

© www.soinside.com 2019 - 2024. All rights reserved.