I am trying to make a crawl script for my roblox game and whenever the animations change it works on the players client, but another players client or even the server the animation wont change and will stay the same. Ive tried everything to try to fix this, but I simply cannot find the solution. If you have any ideas of a way to combat this problem I would be happy it if you could help me out!!!
local script ----
repeat
wait()
until game.Players.LocalPlayer
local player = script.Parent.Parent
local key = game:GetService("UserInputService")
local enabled = false
local function toggleAnimation()
enabled = not enabled
game.ReplicatedStorage.Crawl:FireServer(enabled)
end
key.InputBegan:Connect(function(input, gameProcessedEvent)
if not gameProcessedEvent and input.KeyCode == Enum.KeyCode.C then
toggleAnimation()
end
end)
Server Script
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local AnimationId1 = "rbxassetid://14742973479"
local AnimationId2 = "rbxassetid://11474786201"
local AnimationId3 = "rbxassetid://14826046412"
local AnimationId4 = "rbxassetid://180435571"
ReplicatedStorage.Crawl.OnServerEvent:Connect(function(player, enabled)
local character = player.Character
if not character then
return
end
local Animate = character:FindFirstChild("Animate")
if not Animate then
return
end
if enabled then
character.Humanoid.WalkSpeed = 16
Animate.walk.WalkAnim.AnimationId = AnimationId2
Animate.idle.Animation1.AnimationId = AnimationId4
else
character.Humanoid.WalkSpeed = 10
Animate.walk.WalkAnim.AnimationId = AnimationId1
Animate.idle.Animation1.AnimationId = AnimationId3
end
end)