Local Script:
local Frame1 = script.Parent
local Frame2 = Frame1.Frame
local Frame3 = Frame1.tmp
local cameraPositions = { Vector3.new(10.82, 50.751, 366.13), Vector3.new(223.82, 55.751, 258.13), Vector3.new(-90.18, 55.751, 648.13) }
local Folder = Instance.new("Folder")
local GUISound = Instance.new("Sound", Frame1)
GUISound.SoundId = "rbxassetid://17717353249"
GUISound.Volume = 0.3
GUISound.Looped = true
local buttonSound = Instance.new("Sound", Frame1)
buttonSound.SoundId = "rbxassetid://156286438"
buttonSound.Volume = 0.6
local u4 = 0
local u5 = 0
if game.Teams["Team Selection"].TeamColor ~= game.Players.LocalPlayer.TeamColor then
workspace.CurrentCamera.CameraType = "Custom"
Frame1:Destroy()
else
workspace.CurrentCamera.CameraType = "Scriptable"
wait(0.2)
for i, v in pairs(Frame1.Parent:GetChildren()) do
if v ~= Frame1 and v.Name ~= "Chat" and v.Name ~= "BubbleChat" and v.Name ~= "FreeCamera" then
v.Parent = Folder
end
end
GUISound:Play()
end
local table1 = {}
local VIPTeams = {
["VIP's"] = 8658408,
["Mafia's (VIP)"] = 8673610,
["Hitman's (VIP)"] = 672007208,
["Swat's (VIP)"] = 672028158,
["Millitary (VIP)"] = 671928348,
["DeathBringer's"] = 672023216
}
local Remote3 = game.ReplicatedStorage.Remote
-- Function to check gamepass ownership
function ownsGamePass(gamePassId)
return Remote3.ownsPass:InvokeServer(gamePassId)
end
function addTeam(player)
if VIPTeams[player.Name] then
if ownsGamePass(VIPTeams[player.Name]) then
table.insert(table1, { player.Name, player.TeamColor })
end
else
table.insert(table1, { player.Name, player.TeamColor })
end
end
addTeam(game.Teams.Citizens)
addTeam(game.Teams["Police Officers"])
addTeam(game.Teams.Criminals)
addTeam(game.Teams["Workers"])
addTeam(game.Teams.Priests)
addTeam(game.Teams["VIP's"])
addTeam(game.Teams["Swats"])
addTeam(game.Teams["Millitary"])
addTeam(game.Teams["Mafia's"])
addTeam(game.Teams["Hitmans"])
addTeam(game.Teams["DB's"])
local conn = game:GetService("RunService").RenderStepped:connect(function()
pcall(function()
if u4 > 1080 or u5 == 0 then
u4 = 0
u5 = u5 + 1
if #cameraPositions < u5 then
u5 = 1
end
end
if u4 <= 30 then
Frame1.Blackout.BackgroundTransparency = 0.03333333333333333 * u4
elseif u4 >= 1050 then
end
u4 = u4 + 1
if cameraPositions[u5] ~= nil then
workspace.CurrentCamera.CFrame = CFrame.new(cameraPositions[u5]) * CFrame.Angles(0, math.rad(0.3333333333333333 * u4), 0) * CFrame.Angles(-0.2617993877991494, 0, 0)
end
end)
end)
function trySwap(teamColor)
conn:Disconnect()
local success = Remote3.changeTeam:InvokeServer(teamColor)
if success then
if conn then
conn:Disconnect()
end
workspace.CurrentCamera.CameraType = Enum.CameraType.Custom
end
return success
end
for i, v in pairs(table1) do
pcall(function()
local tmpClone = Frame3:Clone()
tmpClone.Parent = Frame2
tmpClone.Visible = true
tmpClone.Button.BackgroundColor3 = v[2].Color
tmpClone.Button.Text = v[1]
tmpClone.Button.MouseButton1Click:connect(function()
if trySwap(v[2]) == true then
Frame1.Enabled = false
end
end)
tmpClone.Button.MouseEnter:connect(function()
buttonSound:Play()
end)
end)
end
Server Script
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Remote = ReplicatedStorage:WaitForChild("Remote")
local MarketplaceService = game:GetService("MarketplaceService")
local players = game:GetService("Players")
local ownsPass = false
players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function()
repeat
task.wait()
until plr.Character
local humanoid = plr.Character:WaitForChild('Humanoid')
humanoid.Died:Connect(function()
task.wait(players.RespawnTime)
end)
end)
end)
Remote.changeTeam.OnServerInvoke = function(player, teamColor)
player.TeamColor = teamColor
player:LoadCharacter()
end
-- Function to check gamepass ownership
Remote.ownsPass.OnServerInvoke = function(player, passId)
-- Use MarketplaceService to check gamepass ownership
local success, result = pcall(function()
return MarketplaceService:UserOwnsGamePassAsync(player.UserId, passId)
end)
if success then
ownsPass = result
else
warn("Error checking gamepass ownership:", result)
end
return ownsPass
end