A Looped Animation Wont Stop

Hi, I am scripting this thing where once you Trigger The ProximityPrompt the character is supposed to sit down and play a Animation, so far it works but there are still some Issues/Bugs that I can’t Fix like.

  1. Humanoid.AutoRotate = False Doesn’t Work
  2. Once I make the Character Play A animation (Resting Animation which is Looped) when I try to make it stop It doesn’t stop so the Character is always playing this Resting/Sitting Animation.

If Anybody can help me fix these bugs I will really Appreciate it.

There are few things to note: ProximityPrompt is inside of a model that Is in workspace and this Script is being executed from workspace. this is not a Local Sided Script

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local InteractPrompt = script.Parent

local AliveData = ReplicatedStorage.AliveData
local PlayerData = ReplicatedStorage.PlayerData
local RestingAnimation = ReplicatedStorage.Assets.Anims.Misc.Resting

local Rest_Cooldown = false
local Resting = false

InteractPrompt.Triggered:Connect(function(Player)
	if Player then
		local Character = Player.Character
		local Humanoid = Character:WaitForChild("Humanoid")
		local HumanoidRootPart = Character:FindFirstChild("HumanoidRootPart")
		
		local RestingAnim = Humanoid:LoadAnimation(RestingAnimation)
		
		if Resting == false and Rest_Cooldown == false and not AliveData[Player.Name]:FindFirstChild("Combat") then
			Resting = true
			Humanoid.AutoRotate = false
			HumanoidRootPart.Anchored = true
			RestingAnim:Play()
			
		elseif Resting == true then
			Resting = false
			Humanoid.AutoRotate = true
			HumanoidRootPart.Anchored = false
			RestingAnim:Stop()
			RestingAnim:Destroy()
		end
	end	
end)
29 Likes

can you send a video of what happens to get a better idea as well as the heirachy of everything involved in the script?

16 Likes

Sure Ill send a Video of it, I Sadly don’t know what you mean by heirachy of everything involved in the script if you could tell me what you are looking for I will show it to you.

here is the video:

18 Likes

I think it means all the parents and children in explorer.

19 Likes

yeah this is what i meant
\\\\\\\\

15 Likes

Oh alright.

Campfire with the ProximityPrompt:
image

The Resting Animation:
image

PlayerData and AliveData are not being used for now I am Planning on using them in the future they are for mostly Checking if the character is in combat which has nothing to do with the Issue.

If I have missed something please tell me

17 Likes

You never actually check if you start moving. You just check if you are resting when interacting with the ProximityPrompt. You need to do some humanoid stuff to check when you start moving.

14 Likes

What are you suggesting me to do? and I want you to be little more specific on which part do you mean “you just check if you are resting when interacting with the proximityprompt”

8 Likes

Wait, just to be sure, when you stop resting, do you press E again or do you just press a movement key?

12 Likes

well I am trying to recreate Deepwoken campfire system as you saw in the video, I made my Custom ProximityPrompt UI Code so its hard to see if im pressing but yes, you have to press E again to get up.

10 Likes

Right, never mind this then. I thought you didn’t have to press E again.

10 Likes

Oh, Alright.
by any chance do you know how to fix this?

10 Likes

do you have any other scripts that manipulated the character’s animation? maybe they arent reloading the necessary animations

8 Likes

if you mean are there any other Animations that play. I have to say Idle, maybe if you are holding a tool with idle animations, other than that I don’t think so.
I do have this buggy sprint script so maybe? I’m not sure.
the only necessary Animations are walking running idle. Also I am sorry if this reply sounds very confusing cause I didn’t really understand what you spesifically ment.

8 Likes

what i meant is that is there a script that plays your custom animations such as idle, walking and running when you move and can you pull it up?

8 Likes

yes there is a custom script or you can say a different script that plays custom animations. and what do you mean by pull it up do you mean take a picture of them, show them or?

10 Likes

yeah please take a picture and show it

7 Likes

Sure Ill send what ever Movement Animation I find I will not include the Action ones like slashes cause they only play when you are holding a tool and click.

Sprint:

Idle/Walk:

I looked at most of the scripts and these were only ones with Animation such as sprint,idle,walk

7 Likes

also you should do

local RestingAnim = Humanoid:WaitForChild("Animator"):LoadAnimation(RestingAnimation)

Because Humanoid:LoadAnimation() is deprecated

7 Likes

wow this is weird, everything seems fine. does the output print any errors?

6 Likes