I got a new spectate system but still how can i do this with StreamingEnabled on?

I now have a different spectate system script but still how can I do it with streaming enabled?

local toggle = script.Parent.DeathScreen.Spectate
local frame = script.Parent.SpectateFrame
local previous = frame.Prev
local next = frame.Next
local status = frame.Status.CurrentPlayer
local camera = game.Workspace.CurrentCamera
local num = 1

status.Text = game.Players.LocalPlayer.Name

toggle.MouseButton1Click:Connect(function()
	frame.Visible = not frame.Visible
	script.Parent.DeathScreen.Visible = false
end)

previous.MouseButton1Click:Connect(function()
	local players = game.Players:GetChildren()
	local max = #players
	num = num - 1
	if num < 1 then
		num = max
	end
	local player = players[num]
	camera.CameraSubject = player.Character.Humanoid
	status.Text = player.Name
end)

next.MouseButton1Click:Connect(function()
	local players = game.Players:GetChildren()
	local max = #players
	num = num + 1
	if num > max then
		num = 1
	end
	local player = players[num]
	camera.CameraSubject = player.Character.Humanoid
	status.Text = player.Name
end)

frame.Changed:Connect(function()
	if not frame.Visible then
		camera.CameraSubject = game.Players.LocalPlayer.Character.Humanoid
		status.Text = game.Players.LocalPlayer.Name
	end
end)

You can use Player:RequestStreamAroundAsync() to render the area around the player you want to view.

1 Like

Like this?

previous.MouseButton1Click:Connect(function()
	local players = game.Players:GetChildren()
	local max = #players
	num = num - 1
	if num < 1 then
		num = max
	end
	local player = players[num]
	game.Players.LocalPlayer:RequestStreamAroundAsync(player)
	camera.CameraSubject = player.Character.Humanoid
	status.Text = player.Name
end)

next.MouseButton1Click:Connect(function()
	local players = game.Players:GetChildren()
	local max = #players
	num = num + 1
	if num > max then
		num = 1
	end
	local player = players[num]
	game.Players.LocalPlayer:RequestStreamAroundAsync(player)
	camera.CameraSubject = player.Character.Humanoid
	status.Text = player.Name
end)

game.Players.LocalPlayer:RequestStreamAroundAsync(player.Character.HumanoidRootPart.Vector3)

Please read the documentation for more info

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