players = game.Players:GetChildren()
for i = 1, #players do
if players[i]:FindFirstChild("WentThroughCutscene") then
players[i].Character:remove()
wait (.1)
players[i]:LoadCharacter()
end
end
local player1
local player2
local playersin
local Vote1 = Instance.new("IntValue" , game.Workspace)
Vote1.Name = "Vote1"
local Vote2 = Instance.new("IntValue" , game.Workspace)
Vote2.Name = "Vote2"
local nplayers
local Voted = Instance.new("IntValue" , game.Workspace)
Voted.Name = "Voted"
local Callout = Instance.new("StringValue" , game.Workspace)
Callout.Name = "Callout"
local TimePerPlayer = 30
local TimeLeft
local CFrame1 = CFrame.new(193.962, 91.125, 92.637)
local CFrame2 = CFrame.new(154.762, 91.125, 81.037)
function GiveVotes()
players = game.Players:GetChildren()
for i = 1, #players do
if players[i] ~= player1 and players[i] ~= player2 then
vote = game.Workspace.Vote:clone()
vote.Parent = players[i].PlayerGui
vote.Frame.Button1.Text = player1.Name
vote.Frame.Button2.Text = player2.Name
end
end
end
game.Players.PlayerAdded:connect(function(player)
if player.Backpack:FindFirstChild("SoundPlayer") == nil then
script.SoundPlayer:clone().Parent = player.Backpack
end
player.CharacterAdded:connect(function(char)
if player.Backpack:FindFirstChild("SoundPlayer") == nil then
script.SoundPlayer:clone().Parent = player.Backpack
end
end)
end)
function SetFire(model,playerchecking)
modelparts = model:GetChildren()
r = math.random(1,255)
g = math.random(1,255)
b = math.random(1,255)
for i = 1, #modelparts, 2 do
if modelparts[i]:FindFirstChild("Fire") then
modelparts[i].Fire:remove()
end
f = Instance.new("Fire" , modelparts[i])
if game:GetService("GamePassService"):PlayerHasPass(playerchecking, 392668686) then
f.Color = Color3.new(r/255,g/255,b/255)
end
end
end
function RemoveFire(model)
modelparts = model:GetChildren()
for i = 1, #modelparts do
if modelparts[i]:FindFirstChild("Fire") then
modelparts[i].Fire:remove()
end
end
end
RemoveFire(game.Workspace.Barrier1.Fire)
RemoveFire(game.Workspace.Barrier2.Fire)
function RemoveVotes()
players = game.Players:GetChildren()
for i = 1, #players do
if players[i].PlayerGui:FindFirstChild("Vote") then
players[i].PlayerGui.Vote:remove()
end
end
end
RemoveVotes()
function DramaIn()
players = game.Players:GetChildren()
for i = 1, #players do
dramagui = game.Workspace.Drama:clone()
dramagui.Parent = players[i].PlayerGui
dramagui.Top:TweenPosition(UDim2.new(0, 0, 0, 0), "In", "Sine", .75)
dramagui.Bottom:TweenPosition(UDim2.new(0, 0, 1, -300), "In", "Sine", .75)
end
end
function DramaOut()
players = game.Players:GetChildren()
for i = 1, #players do
if players[i].PlayerGui:FindFirstChild("Drama") then
dramagui = players[i].PlayerGui:FindFirstChild("Drama")
dramagui.Top:TweenPosition(UDim2.new(0, 0, 0, -300), "In", "Sine", .75)
dramagui.Bottom:TweenPosition(UDim2.new(0, 0, 1, 0), "In", "Sine", .75)
end
end
wait(.75)
for i = 1, #players do
if players[i].PlayerGui:FindFirstChild("Drama") then
dramagui = players[i].PlayerGui:FindFirstChild("Drama")
dramagui:remove()
end
end
end
DramaOut()
function ClearVotes()
players = game.Players:GetChildren()
for i = 1, #players do
if players[i]:FindFirstChild("Voted") then
lolvote = players[i]:FindFirstChild("Voted")
lolvote:remove()
end
if players[i].PlayerGui:FindFirstChild("Lol") then
players[i].PlayerGui.Lol:remove()
end
end
Vote1.Value = 0
Vote2.Value = 0
end
function VsGui() -- Epic
players = game.Players:GetChildren()
for i = 1, #players do
vsgui = game.Workspace.VsGui:clone()
vsgui.Parent = players[i].PlayerGui
vsgui.Frame.Player1.Image = "http://www.roblox.com/thumbs/avatar.ashx?x=352&y=352&format=png&username="..player1.Name
vsgui.Frame.Player2.Image = "http://www.roblox.com/thumbs/avatar.ashx?x=352&y=352&format=png&username="..player2.Name
vsgui.Frame:TweenPosition(UDim2.new(0.5, -200, 0.5, -150), "In", "Sine", .75)
end
end
function Intermission()
for i = 1, 20 do
TimeLeft = 20 - i
Callout.Value = "Intermission: "..TimeLeft
wait (1)
end
end
function ChoosePlayers()
playertable = {}
players = game.Players:GetChildren()
for i = 1, #players do
if players[i]:FindFirstChild("WentThroughCutscene") then
table.insert(playertable, i, players[i].Name)
if game:GetService("GamePassService"):PlayerHasPass(players[i], 146369230) then
table.insert(playertable, i, players[i].Name)
end
if game:GetService("GamePassService"):PlayerHasPass(players[i], 146370939) then
table.insert(playertable, i, players[i].Name)
end
end
end
--if #players > 2 then
player1 = playertable[math.random(1, #playertable)]
player1 = game.Players:FindFirstChild(player1)
print(player1.Name)
repeat
wait()
player2 = playertable[math.random(1, #playertable)]
player2 = game.Players:FindFirstChild(player2)
print(player2.Name)
until player1 ~= player2
print(player1.Name.." and "..player2.Name)
end
--end
function Teleport()
if player1 ~= nil then
player1.Character.Torso.Anchored = true
player1.Character.Torso.CFrame = CFrame1
end
if player2 ~= nil then
player2.Character.Torso.Anchored = true
player2.Character.Torso.CFrame = CFrame2
end
end
function Clear()
players = game.Players:GetChildren()
for i = 1, #players do
ls = players[i].PlayerGui:GetChildren()
for i = 1, #ls do
if ls[i].className == "LocalScript" and script:FindFirstChild(ls[i].Name) then
ls[i]:remove()
end
end
end
end
function ObjLock(object)
players = game.Players:GetChildren()
for i = 1, #players do
lto = script.LockToObj:clone()
lto.Parent = players[i].PlayerGui
lto.Obj.Value = object
end
end
function CFrameLock(cframeval)
players = game.Players:GetChildren()
for i = 1, #players do
ltc = script.LockToCFrame:clone()
ltc.Parent = players[i].PlayerGui
ltc.CFr.Value = cframeval
end
end
function Fix()
players = game.Players:GetChildren()
for i = 1, #players do
f = script.Fix:clone()
f.Parent = players[i].PlayerGui
end
end
function RunGame()
repeat
playersin = 0
wait()
players = game.Players:GetChildren()
for i = 1, #players do
if players[i]:FindFirstChild("WentThroughCutscene") then
playersin = playersin + 1
Callout.Value = "3 Players are Needed To Start..."
end
end
until playersin > 2
Intermission()
repeat
playersin = 0
wait()
players = game.Players:GetChildren()
for i = 1, #players do
if players[i]:FindFirstChild("WentThroughCutscene") then
playersin = playersin + 1
Callout.Value = "3 Players are Needed To Start..."
end
end
until playersin > 2
Callout.Value = "Preparing..."
ChoosePlayers()
VsGui()
wait (6)
if player1 ~= nil and player2 ~= nil then
Teleport()
ObjLock(player1.Character.Head)
DramaIn()
if player1 ~= nil and player2 ~= nil then
Callout.Value = "Rapper #1: "..player1.Name
wait (3.5)
DramaOut()
wait (1)
Fix()
Clear()
if player1 ~= nil and player2 ~= nil then
ObjLock(player2.Character.Head)
DramaIn()
Callout.Value = "Rapper #2: "..player2.Name
if player1 ~= nil and player2 ~= nil then
wait (3.5)
DramaOut()
Fix()
Clear()
if player1 ~= nil and player2 ~= nil then
Callout.Value = "Time to Rap!"
wait (3)
if player1 ~= nil and player2 ~= nil then
Callout.Value = "Rapper #1, Get Going!"
wait (3)
if player1 ~= nil and player2 ~= nil then
tool = game.Lighting.Microphone:clone()
tool.Parent = player1.Backpack
if player1 ~= nil and player2 ~= nil then
SetFire(game.Workspace.Barrier1.Fire,player1)
for i = 1, 45 do
Callout.Value = player1.Name..", You Got "..(45-i).." Seconds to Trill it Out."
wait(1)
end
RemoveFire(game.Workspace.Barrier1.Fire , player1)
if player1 ~= nil and player2 ~= nil then
Callout.Value = "Now we go to Rapper #2, "..player2.Name
if tool ~= nil then
tool:remove()
end
if sweg ~= nil then
sweg:remove()
end
players = game.Players:GetChildren()
for i = 1, #players do
if players[i].PlayerGui:FindFirstChild("Lol") then
players[i].PlayerGui.Lol:remove()
end
end
wait (2)
if player1 ~= nil and player2 ~= nil then
tool = game.Lighting.Microphone:clone()
tool.Parent = player2.Backpack
SetFire(game.Workspace.Barrier2.Fire,player2)
for i = 1, 45 do
Callout.Value = player2.Name..", You Got "..(45-i).." Seconds to Trill it Out."
wait(1)
end
RemoveFire(game.Workspace.Barrier2.Fire)
if player1 ~= nil and player2 ~= nil then
if tool ~= nil then
tool:remove()
end
if sweg ~= nil then
sweg:remove()
end
players = game.Players:GetChildren()
for i = 1, #players do
if players[i].PlayerGui:FindFirstChild("Lol") then
players[i].PlayerGui.Lol:remove()
end
end
Callout.Value = "Vote for your Favorite Rapper Now!"
Voted.Value = 1
GiveVotes()
wait (4)
for i = 1, 20 do
Callout.Value = "You have "..20-i.." seconds to vote..."
wait(1)
end
Voted.Value = 0
Callout.Value = "The results are in!"
wait (2)
if Vote1.Value > Vote2.Value then
Callout.Value = player1.Name.." Won! "..Vote1.Value.."-"..Vote2.Value
player1.leaderstats.Wins.Value = player1.leaderstats.Wins.Value + 1
player2.Losses.Value = player2.Losses.Value + 1
elseif Vote1.Value < Vote2.Value then
Callout.Value = player2.Name.." Won! "..Vote1.Value.."-"..Vote2.Value
player2.leaderstats.Wins.Value = player2.leaderstats.Wins.Value + 1
player1.Losses.Value = player1.Losses.Value + 1
elseif Vote1.Value == Vote2.Value then
Callout.Value = "There was a draw! "..Vote1.Value.."-"..Vote2.Value
end
end
RemoveVotes()
wait (1)
Vote1.Value = 0
Vote2.Value = 0
if player1 ~= nil then
player1.Character:remove()
wait(.1)
player1:LoadCharacter()
end
if player2 ~= nil then
player2.Character:remove()
wait(.1)
player2:LoadCharacter()
end
end
end
end
end
end
end
end
end
end
end
end
while wait(5) do
if script ~= nil then
RunGame()
end
end
COMMUNITY QUESTION
Rap Battle game works in Test Mode but not Online Pt.2 Game Script?
0 answers
No public answers were preserved for this question.
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
In front of the whole script this code is in it