-
What do you want to achieve? I want to save whenever someone wins a match/survives a round of a disaster.
-
What is the issue? Not sure how to do it.
-
What solutions have you tried so far? I looked everywhere but nothing works witth my code…
Heres my main-game scripts
local lobbyLocation = game.Workspace.Lobby2.Position + Vector3.new(0,3,0)
local gameLocation = game.Workspace.Game.Position + Vector3.new(0,3,0)
local ReplicatedStorage = game:GetService('ReplicatedStorage')
local timeEvent = ReplicatedStorage:WaitForChild('TimeEvent')
local tweenService = game:GetService("TweenService")
local Lava = game.Workspace.Other.Lava
local tweeninfo = TweenInfo.new(20,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut,0,false,0)
local tweeninfo2 = TweenInfo.new(1,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut,0,false,0)
local move2 = {
Position = Vector3.new(-0.049, 22.754, -5.795)
}
local move = {
Position = Vector3.new(0, -43.124, -5.795)
}
local tween = tweenService:Create(Lava,tweeninfo2,move)
local tween2 = tweenService:Create(Lava,tweeninfo,move2)
local function playGame()
tween2:Play()
print("Game Started!")
local timeAmount = 20
local timerText = 'Game Time: '
while timeAmount > 0 do
timeEvent:FireAllClients(timeAmount, timerText)
wait(1)
timeAmount -= 1
end
end
local function beforeGame()
print("Game is Starting!")
local beforeGame = 5
local beforeText = 'Lava Starts In: '
while beforeGame > 0 do
timeEvent:FireAllClients(beforeGame, beforeText)
wait(1)
beforeGame -= 1
end
end
local function playIntermission()
tween:Play()
print("Intermission has started!")
local intermission = 3
local timerText = ' '
while intermission > 0 do
timeEvent:FireAllClients(intermission, timerText)
wait(1)
intermission -= 1
end
end
local function resetPlayers()
print("Players have been reset!")
for _, plr in pairs(game.Players:GetChildren()) do
plr.Character.HumanoidRootPart.CFrame = CFrame.new(lobbyLocation)
end
end
local function teleportPlayers()
print("Players were teleported!")
for _, plr in pairs(game.Players:GetChildren()) do
plr.Character.HumanoidRootPart.CFrame = CFrame.new(gameLocation)
end
end
while true do
resetPlayers()
playIntermission()
teleportPlayers()
beforeGame()
playGame()
end