How to make a Spectate Gui On Roblox Studio

Опубликовано: 25 Октябрь 2024
на канале: StudioTutorialzYT
10,221
353

#RobloxStudioTutorials

---- ★ Songs ★ ----

Intro Song Link: chill anthem - BROCKBEATS:    • chill anthem  

Outro Song Link: Sweetest - Murat Uslu: (The song got deleted for some reason so here is the link to his youtube channel):    / @muratuslu4013  

Background Music: LuKremBo - boba tea:    • lukrembo - boba tea (royalty free vlo...  

---- ★ Friend's Game Link! ★ ----

https://web.roblox.com/games/56477165...

---- ★ Profile Link! ★ ----

https://web.roblox.com/users/97907289...

---- ★ Script ★ ----

----- By super10099

cam = game.Workspace.CurrentCamera

local bar = script.Parent.Bar
local title = bar.Title
local prev = bar.Previous
local nex = bar.Next
local button = script.Parent.Button

function get()
for _,v in pairs(game.Players:GetPlayers())do
if v.Name == title.Text then
return(_)
end
end
end


local debounce = false
button.MouseButton1Click:connect(function()
if debounce == false then debounce = true
bar:TweenPosition(UDim2.new(.5,-100,0.88,-50),"In","Linear",1,true)
pcall(function()
title.Text = game.Players:GetPlayerFromCharacter(cam.CameraSubject.Parent).Name
end)
elseif debounce == true then debounce = false
pcall(function() cam.CameraSubject = game.Players.LocalPlayer.Character.Humanoid end)
bar:TweenPosition(UDim2.new(-1,-100,0.88,-50),"In","Linear",1,true)
end
end)

prev.MouseButton1Click:connect(function()
wait(.1)
local players = game.Players:GetPlayers()
local num = get()
if not pcall(function()
cam.CameraSubject = players[num-1].Character.Humanoid
end) then
cam.CameraSubject = players[#players].Character.Humanoid
end
pcall(function()
title.Text = game.Players:GetPlayerFromCharacter(cam.CameraSubject.Parent).Name
end)
end)

nex.MouseButton1Click:connect(function()
wait(.1)
local players = game.Players:GetPlayers()
local num = get()
if not pcall(function()
cam.CameraSubject = players[num+1].Character.Humanoid
end) then
cam.CameraSubject = players[1].Character.Humanoid
end
pcall(function()
title.Text = game.Players:GetPlayerFromCharacter(cam.CameraSubject.Parent).Name
end)
end)