Animation Collision Issue

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I’m making an indie roblox horror game, and am currently scripting for the chase sequence. At this point, I’m making the end animation for the chase, to do this i use a trigger part with no collision, which fires a RemoteEvent from a server script, then going to a localscript which organizes the animations. Both scripts will be attached.

  2. What is the issue? Include screenshots / videos if possible!
    At the end of the chase, the main character gets pushed off of a cliff and into water, by a separate rig. The main character’s animation works fine, but due to what I believe is the collisions, the monster (just a normal r6 rig) is smacking into a wall, thus messing up the animation.

Another little detail is the way the main rig flings at the end.

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I have already made a dev forum post, but i decided to make a new one that’s a little more in depth, as no-one way replying to the last one.
    I also got chat gpt to analyze my code, but that was not much help as usual.

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

PhaseTwoStarter - Server Script Located In The Trigger Part.

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")

local Event = ReplicatedStorage.Remotes:WaitForChild("ChasePhaseTwo")
local DisableEvent = ReplicatedStorage.Remotes:WaitForChild("DisableControls")
local EnableEvent = ReplicatedStorage.Remotes:WaitForChild("EnableControls")

local debounce = {}

script.Parent.Touched:Connect(function(hit)
	local character = hit.Parent
	local player = Players:GetPlayerFromCharacter(character)

	if player and character:FindFirstChild("Humanoid") and not debounce[player] then
		debounce[player] = true

		-- Disable controls and trigger phase two
		DisableEvent:FireClient(player)
		Event:FireClient(player)

		-- Move player
		character:MoveTo(workspace.PlayerHide.Position)

		-- Wait and trigger phase two again
		task.wait(20)
		Event:FireClient(player)

		-- Optional: Re-enable controls after phase
		EnableEvent:FireClient(player)

		-- Remove debounce after some time if needed
		task.wait(5)
		debounce[player] = nil
	end
end)

Phase Two Handler - LocalScript in StarterPlayerScripts

local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local TweenService = game:GetService("TweenService")

local player = Players.LocalPlayer
local camera = workspace.CurrentCamera
local Event = ReplicatedStorage.Remotes:WaitForChild("ChasePhaseTwo")

local Characters = ReplicatedStorage:WaitForChild("EndChaseAnimation")
local John = Characters:WaitForChild("NaughtyJohn")
local Main = Characters:WaitForChild("PlayerModel")

local spawnLocation = workspace:WaitForChild("ChaseStartPosition") -- A part you place manually in workspace
local ChaseTriggerer = workspace:WaitForChild("ObjectiveParts"):WaitForChild("ChasePhaseTwo")

Event.OnClientEvent:Connect(function()
	-- Ensure spawn location exists
	if not spawnLocation then
		warn("ChaseStartPosition not found in workspace!")
		return
	end
	
	ChaseTriggerer:Destroy()

	-- Move models into workspace
	Characters.Parent = workspace

	-- Set starting positions
	local basePosition = spawnLocation.Position

	-- Set Player (Main) facing the same direction as the part
	Main:SetPrimaryPartCFrame(CFrame.new(basePosition, basePosition + spawnLocation.CFrame.LookVector))

	-- Set John behind the player, facing the same direction as the part
	local johnPosition = basePosition - spawnLocation.CFrame.LookVector -- John 5 studs behind
	John:SetPrimaryPartCFrame(CFrame.new(johnPosition, johnPosition + spawnLocation.CFrame.LookVector))

	-- Load animations
	local JohnAnim = script:WaitForChild("John")
	local MainAnim = script:WaitForChild("Player")

	local JohnHumanoid = John:WaitForChild("Humanoid")
	local MainHumanoid = Main:WaitForChild("Humanoid")

	local JohnAnimTrack = JohnHumanoid:LoadAnimation(JohnAnim)
	local MainAnimTrack = MainHumanoid:LoadAnimation(MainAnim)

	-- Set animation priority
	JohnAnimTrack.Priority = Enum.AnimationPriority.Movement
	MainAnimTrack.Priority = Enum.AnimationPriority.Movement

	-- Set camera to follow PlayerModel and adjust distance (Optional)
	camera.CameraSubject = Main:WaitForChild("Torso")
	camera.CameraType = Enum.CameraType.Custom
	camera.CFrame = camera.CFrame * CFrame.new(0, 5, -10)  -- Adjust as needed

	-- Play animations
	JohnAnimTrack:Play()
	MainAnimTrack:Play()
	MainAnimTrack.Ended:Connect(function()
		camera.CameraSubject = player.Character:FindFirstChild("Torso")
	end)
end)

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

6 Likes

That’s simple, juet anchor the HumanoidRootPart (and use Main:PivotTo())

2 Likes

where do i use Main:PivotTo()?

2 Likes

PivotTo() is what you want to use when you need to move the rig into position before the animation starts. You’ll want to use it in your LocalScript, inside that Event.OnClientEvent function where you’re handling the cutscene stuff.

What I’d do is place a part in the workspace where you want the Main rig to be when the final animation begins — call it something like MainAnimationStartPoint. Then in the script, do this:

local targetCFrame = workspace:WaitForChild("MainAnimationStartPoint").CFrame
Main:PivotTo(targetCFrame)

Just throw that in right after you destroy the trigger and before any animation or camera stuff starts. It’ll teleport the Main rig right to that part, keeping it lined up correctly.

Also, if your monster rig (John) is bouncing off walls and messing up the animation, it’s probably just collision stuff. Try looping through the rig’s parts and setting .CanCollide = false before the animation starts — that usually fixes it. You could also just anchor it if it’s not supposed to be moving via physics.

add collision groups for the walls and not floor. and trigger it when the animation starts

ill try this right now, thanks for the help

So this mostly works, except the monster is offset from the main, which makes the animation slightly unreadable.

(ignore the location thing, thats something another member of the team made as a placeholder)

1 Like

Wow! Its looking super promising so far, can’t wait to see the final thing! Here’s some help on your issue:

  1. Sync John’s position relative to Main properly. Right now you’re doing:
local johnPosition = basePosition - spawnLocation.CFrame.LookVector

Which kinda blindly puts John “behind” the player, but depending on the rig sizes and how the animations are lined up, that could cause the offset. Try being more precise.

What you can do instead is something like this:

-- Get offset directly from a dummy setup
local offsetCFrame = Main.PrimaryPart.CFrame:ToObjectSpace(John.PrimaryPart.CFrame)

– Then, after you move Main into position
Main:PivotTo(targetCFrame)

– Apply same relative offset to John
John:PivotTo(Main.PrimaryPart.CFrame * offsetCFrame)

This way John ends up in the exact relative spot he was during animation setup in Studio — no guesswork.

  1. Collision still bugging out? If John’s getting snagged, yeah, disable collisions right before anim starts:
for _, part in ipairs(John:GetDescendants()) do
	if part:IsA("BasePart") then
		part.CanCollide = false
	end
end

You could even wrap that in a small utility function if you’re doing this kind of thing in multiple spots.

  1. Bonus Tip — Collision Groups (if needed): If you wanna get fancy and not kill collisions for everything, yeah, set up a collision group for John and have it ignore certain walls. It’s a little more setup, but Roblox’s CollisionGroup API gives you a lot of control.

Good luck and keep going, it’s looking fab!

1 Like

it’s so close, but still slightly offset

1 Like

if it’s still slightly offset, chances are there’s either a tiny mismatch in how the rig was positioned during setup or something’s shifting a bit when the animation plays. Double check that both Main and John were aligned exactly how you want them in Studio before baking the offset — like, make sure the idle animation or whatever pose you used when grabbing that offset wasn’t already nudging John a bit.

Also, depending on how your animations are being loaded/applied, sometimes the animation itself can apply a slight positional nudge (especially if the root joint is being touched). You might wanna preview just the idle pose with no movement and see if that alone causes drift.

Another trick you could try — after applying the PivotTo stuff, do a one-frame wait and then reapply the offset to John again. Just in case some internal positioning is updating a frame later (Roblox can be funky like that sometimes).

And yeah, if it’s still bugging out with collisions or jittering a bit, double-confirm those are off during animation — even one rogue part with collisions can push the rig just enough to break the illusion.

Turns out the offset was actually the animation! It’s fixed now. Thanks so much for the help, I have marked you as solution!

1 Like