Character bugging after animation and PrimaryPart anchor

Hello Roblox Dev Community,

Info
I have gotten a problem with my character.
So what’s happening here is that when i press on a proximity prompt. An animation will trigger, after that i will get anchored and when the animation finishes i get unanchored and teleported to an different position. Everything works fine but if i make a quick movement my character buggs.

Videos

Before
Uploading: 2023-01-04 08-25-33.mp4…
After

Code
local function ()
	char.PrimaryPart.Anchored = true
	char:SetPrimaryPartCFrame(cframe)
	track:Play()
	wait(1.06)
	track:Stop()
	char.PrimaryPart.Anchored = false
	char:SetPrimaryPartCFrame(cframe * CFrame.new(0, 0, -4)) 
end

The problem
So basicly when i anchor my character and then make it play the animation then it start bugging as you can see in the After video.

I really don’t know how to fix this problem. I would really love solutions from people so feel free to comment.

Cya!
:wave: :waffle:

It sounds like the issue you are experiencing is related to the character’s PrimaryPart becoming unanchored while the animation is still playing. This can cause the character to become unstable and potentially bug out.

One way to fix this issue would be to make sure the character’s PrimaryPart remains anchored until the animation has finished playing. You can do this by moving the line that sets the PrimaryPart’s Anchored property to false to after the track:Stop() line, like this:

local function ()
	char.PrimaryPart.Anchored = true
	char:SetPrimaryPartCFrame(cframe)
	track:Play()
	wait(1.06)
	track:Stop()
	char:SetPrimaryPartCFrame(cframe * CFrame.new(0, 0, -4))
	char.PrimaryPart.Anchored = false
end

This will ensure that the character’s PrimaryPart remains anchored until the animation has finished playing, which should help to prevent the character from bugging out.

I hope this helps! If you have any more questions, don’t hesitate to ask.

if you don’t like a response by a AI please ignore this

I’m only trying to help

This code was made by AI

It still bugs for me after making the code like this:

	char.PrimaryPart.Anchored = true
	char:SetPrimaryPartCFrame(cframe)
	track:Play()
	wait(1.06)
	track:Stop()
	char:SetPrimaryPartCFrame(cframe * CFrame.new(0, 0, -4)) 
        char.PrimaryPart.Anchored = false
	triggerEvent:FireServer()

I have also tried

	char.PrimaryPart.Anchored = true
	char:SetPrimaryPartCFrame(cframe)
	track:Play()
	wait(1.06)
	track:Stop()
	char:SetPrimaryPartCFrame(cframe * CFrame.new(0, 0, -4)) 
	triggerEvent:FireServer()
	char.PrimaryPart.Anchored = false

But it doesn’t works?

                                               ⚠️ Warning ⚠️

I’m only trying to help

This code was made by AI

Based on the code you have provided, it looks like you are trying to play an animation, move the character to a new location, and then fire a server event. Here are a few suggestions that might help you resolve the issue you are experiencing.

  1. Make sure that the values you are using for cframe and CFrame.new(0, 0, -4) are valid. If these values are not correct, the character may not move as expected.
  2. Check the length of the animation track. If the track is longer than 1.06 seconds, the character may not have finished moving when the server event is fired. Try increasing the length of the wait function to match the length of the track.
  3. Make sure that the server event is correctly defined and that you have permission to fire it. If the event is not set up properly or you do not have the necessary permissions, it will not be fired.

I hope these suggestions are helpful! Let me know if you have any further questions or if you need more guidance.

if you don’t like a response by a AI please ignore this

I’m only trying to help

This code was made by AI

1 Like

Are you the openchat GPT AI?
Based on your responses you seem like it.

he is just spamming the devforum.

No, I’m using the AI to help people

my bad for the off-topic

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.