Unloading 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 a chase end cutscene, and have everything working so far!

  2. What is the issue? Include screenshots / videos if possible!
    The one issue is that for some reason, when i trigger the cutscene, everything starts unloading. I’m not talking about just a few parts here and there, everything in sight just disappears.

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    ChatGPT
    Changing my graphics quality

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
local ChaseTriggerer = workspace:WaitForChild("ObjectiveParts"):WaitForChild("ChasePhaseTwo")

-- Utility function to disable collisions
local function disableCollisions(model)
	for _, part in ipairs(model:GetDescendants()) do
		if part:IsA("BasePart") then
			part.CanCollide = false
		end
	end
end

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

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

	-- Move models into workspace
	Characters.Parent = workspace
	ChaseTriggerer:Destroy()

	-- Record John's relative offset from Main using the original animation setup
	local offsetCFrame = Main.PrimaryPart.CFrame:ToObjectSpace(John.PrimaryPart.CFrame)

	-- Move Main into position
	Main:PivotTo(targetCFrame)

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

	-- Disable John's collisions before animation starts
	disableCollisions(John)

	-- 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("Head")
	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.

1 Like

I know what issue you are experiencing,
try using.
game.Players.LocalPlayer:RequestStreamAroundAsync(camera.CFrame.Position,1)

So the problem is likely wih streaming enabled and the area not being streamed in when the cutscene is at that position.
Or it appears you disabled the collision of ‘John’ and your character fell through the floor.

1 Like

Thanks, I’ll try this soon. (also, he didn’t fall through the floor, hes just at the top of the ramp, if you look closely.)