I’m trying to make a JoJo game. Similar to Your Bizarre Adventure on roblox. And what I’m trying to do is whenever the player moves to a specific direction, then a corresponding animation plays for the rig.
So I know that I have to make a remote event to detect where the player is moving, but when the rig’s animation changes once, it doesn’t return to Idle.
I have made a script which when the “Q” button is pressed, then the player summons the rig and a summon animation plays and I think it’s one of the reason the other animations are interupted.
Nothing on the devforum helped for my problem
Local script
local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")
Humanoid:GetPropertyChangedSignal("MoveDirection"):Connect(function()
if math.round(Humanoid.MoveDirection.X) == -1 then
game:GetService("ReplicatedStorage"):WaitForChild("StandMovement"):FireServer("MovingLeft")
elseif math.round(Humanoid.MoveDirection.X) == 1 then
game:GetService("ReplicatedStorage"):WaitForChild("StandMovement"):FireServer("MovingRight")
elseif math.round(Humanoid.MoveDirection.Z) == -1 then
game:GetService("ReplicatedStorage"):WaitForChild("StandMovement"):FireServer("MovingForward")
elseif math.round(Humanoid.MoveDirection.Z) == 1 then
game:GetService("ReplicatedStorage"):WaitForChild("StandMovement"):FireServer("MovingBackward")
elseif Humanoid.MoveDirection == 0 then
game:GetService("ReplicatedStorage"):WaitForChild("StandMovement"):FireServer("Idle")
end
end)
Server Script
game:GetService("ReplicatedStorage"):WaitForChild("StandMovement").OnServerEvent:Connect(function(player, state)
local character = workspace:WaitForChild(player.Name)
local stand = character:WaitForChild("TheWorld")
local Idle = stand.AnimationController:LoadAnimation(stand.Idle)
local Backward = stand.AnimationController:LoadAnimation(stand.MovingBackward)
local summon = stand.AnimationController:LoadAnimation(stand.Summon)
if state == "Idle" then
Idle.AnimationPriority = Enum.AnimationPriority.Idle
Idle:Play(0.00001)
elseif state == "MovingBackward" then
Backward:Play(0.00001)
end
end)