You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
I’m making an animation play for the end of a chase for my horror game. There are two rigs, the one that the camera is attached to (Main) and the monster (John). -
What is the issue? Include screenshots / videos if possible!
The animation is playing fine, but the Monster rig is going into the wall when the animation starts. I think this is because the Monster is pointing the wrong way. -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I have had multiple conversations with ChatGPT. I have searched on the Devforum, but I couldn’t find anyone with the same problem.
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!
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
Event.OnClientEvent:Connect(function()
-- Ensure spawn location exists
if not spawnLocation then
warn("ChaseStartPosition not found in workspace!")
return
end
-- 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 * 5 -- 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()
end)