Don’t really know what the problem is, I have a crouch animation script that works fine using a regular R6 character and it’s a local script inside of StarterPlayerScripts, but when I change characters I get that error, tried looking for a solution and couldn’t find any, the animation is R6 done on an R6 dummy, then when that failed I imported animation onto the morph itself and tried using the animation made specifically for that morph and I still got the error.
This is the morph script (server-side script):
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAppearanceLoaded:connect(function(died)
if table.find(ranks,player:GetRankInGroup(GroupID)) then
local spawnpoint = game.Workspace.SpawnLocation
local oldCharacter = player.Character
local oldCharacterHumanoid = oldCharacter:WaitForChild("Humanoid")
local newCharacter = ServerStorage.Witch:Clone()
local newCharacterHumanoid = newCharacter:WaitForChild("Humanoid")
newCharacter.Name = oldCharacter.Name
newCharacter.HumanoidRootPart.Anchored = false
newCharacter:SetPrimaryPartCFrame(spawnpoint.CFrame)
player.Character = newCharacter
oldCharacter:Destroy()
newCharacter.Parent = workspace
end
end)
end)
crouching anim script with the error: (its on line 17, but again the script works fine not using the new character)
local Player = game.Players.LocalPlayer
local Character = Player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")
local UserInputService = game:GetService("UserInputService")
local isCrouching = false
local originalJumpPower = Humanoid.JumpPower
local crouchIdleAnimInstance = Instance.new("Animation")
crouchIdleAnimInstance.AnimationId = "rbxassetid://14652587661"
local crouchMoveAnimInstance = Instance.new("Animation")
crouchMoveAnimInstance.AnimationId = "rbxassetid://14652587661"
local crouchIdleAnim = Humanoid:LoadAnimation(crouchIdleAnimInstance)
local crouchMoveAnim = Humanoid:LoadAnimation(crouchMoveAnimInstance)
local function onInputBegan(input)
if input.KeyCode == Enum.KeyCode.LeftControl then
isCrouching = true
Character.Humanoid.UseJumpPower = true
Humanoid.JumpPower = 0
if Humanoid.MoveDirection.Magnitude == 0 then
crouchIdleAnim:Play()
else
crouchMoveAnim:Play()
end
end
end
local function onInputEnded(input)
if input.KeyCode == Enum.KeyCode.LeftControl then
isCrouching = false
Humanoid.JumpPower = originalJumpPower
crouchIdleAnim:Stop()
crouchMoveAnim:Stop()
end
end
local function onHumanoidMoving()
if isCrouching then
if Humanoid.MoveDirection.Magnitude == 0 then
crouchMoveAnim:Stop()
crouchIdleAnim:Play()
else
crouchIdleAnim:Stop()
crouchMoveAnim:Play()
end
end
end
-- Connect events
UserInputService.InputBegan:Connect(onInputBegan)
UserInputService.InputEnded:Connect(onInputEnded)
Humanoid:GetPropertyChangedSignal("MoveDirection"):Connect(onHumanoidMoving)