I made an custom player animation, which isnt working. The animation is uploaded by me, its set to movement, the script is present in the server script.
The video:
The script:
local function onCharacterAdded(character)
local humanoid = character:WaitForChild("Humanoid")
for _, playingTracks in pairs(humanoid:GetPlayingAnimationTracks()) do
playingTracks:Stop(0)
end
local animateScript = character:WaitForChild("Animate")
animateScript.walk.WalkAnim.AnimationId = "rbxassetid://8911048329" -- Walk
local function onPlayerAdded(player)
player.CharacterAppearanceLoaded:Connect(onCharacterAdded)
end
Players.PlayerAdded:Connect(onPlayerAdded)
end
You’re connecting the events in the wrong scopes. You should be connecting the PlayerAdded event OUTSIDE the scope first, THEN you connect the CharacterAdded event with the function.
i tried fixing the script, idk where i went wrong.
local Players = game:GetService("Players")
local function onPlayerAdded(player)
local function onCharacterAdded(character)
player.CharacterAppearanceLoaded:Connect(onCharacterAdded)
local humanoid = character:WaitForChild("Humanoid")
for _, playingTracks in pairs(humanoid:GetPlayingAnimationTracks()) do
playingTracks:Stop(0)
end
local animateScript = character:WaitForChild("Animate")
animateScript.walk.WalkAnim.AnimationId = "rbxassetid://8911048329" -- Walk
end
end
Players.PlayerAdded:Connect(onPlayerAdded)```
local Players = game:GetService("Players")
local function onPlayerAdded(player)
player.CharacterAppearanceLoaded:Connect()
local character = player.Character
local humanoid = character:WaitForChild("Humanoid")
for _, playingTracks in pairs(humanoid:GetPlayingAnimationTracks()) do
playingTracks:Stop(0)
end
local animateScript = character:WaitForChild("Animate")
animateScript.walk.WalkAnim.AnimationId = "rbxassetid://8911048329" -- Walk
end)
end
Players.PlayerAdded:Connect(onPlayerAdded)
walk is not a valid member of Script “killeraman6.Animate” - error, everything else is fine but the animate script in the player during the game is disable and no contents are there in it.