I added the 3,2,1 Decal in the ImageLabel. This is PlaceRebuilder's but I want to test them out. Well, it didn't work for some reason. This is the script (LONG SCRIPT):
local checkpoint1 = game.Workspace.MapHolder.Map1Beginner.Checkpoint1
local checkpoint2 = game.Workspace.MapHolder.Map1Beginner.Checkpoint2
local checkpoint3 = game.Workspace.MapHolder.Map1Beginner.Checkpoint3
local redLight = game.Workspace.MapHolder.Map1Beginner.StartLight.RedModel.LightBulb.PointLight
local yellowLight = game.Workspace.MapHolder.Map1Beginner.StartLight.YellowModel.LightBulb.PointLight
local greenLight = game.Workspace.MapHolder.Map1Beginner.StartLight.GreenModel.LightBulb.PointLight
local startBarrier = game.Workspace.MapHolder.Map1Beginner.StartBarrier
local image = game.StarterGui.ScreenGui.ImageLabel
image.Visible = false
local raceInProgress = false
local lobbySpawn = game.Workspace.LobbySpawn
local trackSpawn = game.Workspace.MapHolder.Map1Beginner.TrackSpawn
local minimumPlayers = 1
function destroyCars()
for _, object in pairs(game.Workspace:GetChildren()) do
print(object.Name)
if object.Name == "Car" then
print("This is a car! We need to destroy it!")
object:Destroy()
end
end
end
function createCars()
for _, object in pairs(game.ServerStorage:GetChildren()) do
local carCopy = object:Clone()
carCopy.Parent = game.Workspace
carCopy:MakeJoints()
end
end
function showVictoryMessage(playerName)
local message = Instance.new("Message")
message.Text = playerName .. " has won!"
message.Parent = game.Workspace
wait(2)
message:Destroy()
end
function checkpoint1hit(otherPart)
print("Checkpoint 1 was hit")
print(otherPart.Name)
if otherPart ~= nil and otherPart.Parent ~= nil and otherPart.Parent:FindFirstChild("Humanoid") then
print("A player hit me!")
if not checkpoint1:FindFirstChild(otherPart.Parent.Name) then
local playerTag = Instance.new("StringValue")
playerTag.Parent = checkpoint1
playerTag.Name = otherPart.Parent.Name
end
if checkpoint3:FindFirstChild(otherPart.Parent.Name) and raceInProgress then
print("Player wins!")
raceInProgress = false
showVictoryMessage(otherPart.Parent.Name)
end
end
end
function checkpoint2hit(otherPart)
print("Checkpoint 2 was hit")
print(otherPart.Name)
if otherPart ~= nil and otherPart.Parent ~= nil and otherPart.Parent:FindFirstChild("Humanoid") then
print("A player hit me!")
if not checkpoint2:FindFirstChild(otherPart.Parent.Name) and checkpoint1:FindFirstChild(otherPart.Parent.Name) then
local playerTag = Instance.new("StringValue")
playerTag.Parent = checkpoint2
playerTag.Name = otherPart.Parent.Name
end
end
end
function checkpoint3hit(otherPart)
print("Checkpoint 3 was hit")
print(otherPart.Name)
if otherPart ~= nil and otherPart.Parent ~= nil and otherPart.Parent:FindFirstChild("Humanoid") then
print("A player hit me!")
if not checkpoint3:FindFirstChild(otherPart.Parent.Name) and checkpoint2:FindFirstChild(otherPart.Parent.Name) then
local playerTag = Instance.new("StringValue")
playerTag.Parent = checkpoint3
playerTag.Name = otherPart.Parent.Name
end
end
end
checkpoint1.Touched:connect(checkpoint1hit)
checkpoint2.Touched:connect(checkpoint2hit)
checkpoint3.Touched:connect(checkpoint3hit)
function startLightCycle()
redLight.Enabled = true
image.Visible = true
image.Image = "www.roblox.com/asset/?id=232379905"
wait(1)
redLight.Enabled = false
yellowLight.Enabled = true
image.Image = "www.roblox.com/asset/?id=232379905"
wait(1)
yellowLight.Enabled = false
greenLight.Enabled = true
image.Image = "www.roblox.com/asset/?id=232379905"
end
function removeBarrier()
startBarrier.Transparency = 1
startBarrier.CanCollide = false
image.Image = "www.roblox.com/asset/?id=232379905"
end
function resetLights()
redLight.Enabled = false
yellowLight.Enabled = false
greenLight.Enabled = false
end
function resetBarrier()
startBarrier.Transparency = .5
startBarrier.CanCollide = true
image:Destroy()
end
function clearCheckpoint(checkpoint)
for _, object in pairs(checkpoint:GetChildren()) do
if object.Name ~= "TouchInterest" then
object:Destroy()
end
end
end
function teleportPlayers(target)
for _, player in pairs(game.Players:GetChildren()) do
while player.Character == nil do
wait()
end
local character = player.Character
local torso = character:WaitForChild("Torso")
torso.CFrame = target.CFrame
end
end
wait(10)
while true do
-- wait for enough players before we start the game
while game.Players.NumPlayers < 1 do
wait()
end
-- setup racetrack
-- turn off all lights
resetLights()
-- reset barrier
resetBarrier()
-- create all cars
createCars()
-- clear all checkpoints
clearCheckpoint(checkpoint1)
clearCheckpoint(checkpoint2)
clearCheckpoint(checkpoint3)
-- teleport all players to the racetrack
teleportPlayers(trackSpawn)
wait(5)
-- start race
-- start light cycle
startLightCycle()
-- remove barrier
removeBarrier()
raceInProgress = true
-- wait for race to finish
while raceInProgress == true do
wait()
end
wait(2)
-- delete all cars
destroyCars()
wait(2)
-- teleport all players to the lobby
teleportPlayers(lobbySpawn)
wait(10)
end
The Images are in Line 096 to 118. Sorry if it is long, but please, if you can, fix it. :)
