A Looped Animation Wont Stop

Didn’t work also take your time on finding solutions

3 Likes

you put your custom idle animation’s id in the variable right?

3 Likes

yes I did but even if that worked there are like 10 or more custom idles for when u equip a specific type of sword like greatsword fists sword and others

3 Likes

Ok have you tried converting every Humanoid:LoadAnimation() to a Humanoid:WaitForChild(Animator):LoadAnimation([animationID])? even if it doesnt work its good to keep in your script since Humanoid:LoadAnimation() is deprecated.

IdleAnim = [Put idle id here]
InteractPrompt.Triggered:Connect(function(Player)
	if Player then
		local Character = Player.Character
		local Humanoid = Character:WaitForChild("Humanoid")
		local HumanoidRootPart = Character:FindFirstChild("HumanoidRootPart")
		
		if Resting == false and Rest_Cooldown == false and not AliveData[Player.Name]:FindFirstChild("Combat") then

            RestingAnim = Humanoid:LoadAnimation(RestingAnimation)
			Resting = true
			Humanoid.AutoRotate = false
			HumanoidRootPart.Anchored = true
			RestingAnim:Play()

			print(RestingAnim.Ended)

            InteractPrompt.Triggered:Wait()

			print(RestingAnim.Ended)

			IdleAnim = Humanoid:WaitForChild("Animator"):LoadAnimation(IdleAnim)
			Resting = false
			Humanoid.AutoRotate = true
			HumanoidRootPart.Anchored = false
			RestingAnim:Stop()
			RestingAnim:Destroy()

			local IdleAnimation = Humanoid:WaitForChild("Animator"):LoadAnimation(IdleAnim)
			IdleAnimation:Play()

        else return end

	end	
end)

sorry copy the script again i made some changes

3 Likes

I haven’t tried and sadly I am not using AnimationID’s for a reason if you mean the resting ID then sure but if it comes to other idles then I can’t cause its gonna mess up lots of stuff

3 Likes

use the default idle animation not any others

4 Likes

Hold up is this a server script? If so it will totally bug out if another player comes and tries to sit.

4 Likes

as I sent a picture this is Server Script inside of the prox inside of model inside of a workspace so yes
i guess you can say that

3 Likes

how so? the script applies changes depending on the player who triggered the prompt

3 Likes

that is true
\\\\\\\\\\\\\

2 Likes

You have one variable for the entire script called resting. If one player rests the value will be true

3 Likes

im gonna test that
/////////////

1 Like

have you already tried this code?

you are right, what should I do then cause I tried using a local script but proximityprompt didnt work with local scripts

No I mean if you only have one variable shared for all players it’s gonna cause interference. Each player should have their own resting variable.

Are you suggesting I put the resting variable inside of the function?

That wouldn’t work either. You should put a dictionary with all player data, and might as well keep the resting value in that.

You gave me a idea what if i make a resting variable inside of the alive data. Alive data is a folder with each players name that has like mana and other stuff in it that resets everytime u die or leave the game

It does, LocalScripts don’t work in workspace. They work in:

  • ReplicatedFirst
  • StarterCharacterScripts
  • StarterPlayerScripts

I somehow never knew that, thanks for telling me don’t they also work in startergui? And there are gonna be more than 1 campfire so I guess I cant use any of those 3