I am making a mingame game and I can't teleport players to the right place. TF firing is for Intermission, it changes the Timer every second . FloodItIs is a teleportation place for the minigame to begin. Result is the result of math.Random to choose between minigames this code:
math.Random(Vector3.new(258 or 248 or 238, 248, 258 or 248 or 238))
is for the swordfights mingame and flooditis is for the flood Escape minigame once All of the players ScreenGuis show 0 then It will start the code
PS if their is a better or cleaner way to make the timer too, it would be helpful if you mentioned it i dont know how to use Cframe well so please tell me if i have errors code is below
code in starter player scripts local script
local RS = game:GetService("ReplicatedStorage")
local TF = RS:WaitForChild("TimeForever")
local TD = RS:WaitForChild("TD")
local function Time(Part)
game.Players.LocalPlayer.PlayerGui.ScreenGui.TextLabel.Text -=1
if game.Players.LocalPlayer.PlayerGui.ScreenGui.TextLabel.Text == 0 and RS.Value == ("Lobby") then
local PN = script.Parent.Parent
game.Workspace(PN.Name).HumanoidRootPart.CFrame = Part.CFrame
PN:FindFirstChild("Roblox").Value = ("Start")
end
end
TF.OnClientEvent:Connect(Time)
code in serverscript service regular script:
local Players = game.Players:GetPlayers()
local GS = game.ReplicatedStorage.GameStatus
local RS = game:GetService("ReplicatedStorage")
local TF = RS.TimeForever
GS.Value = ("Lobby")
repeat
wait()
until #game.Players:GetPlayers() == 1
repeat
TF:FireAllClients(TF)
wait(1)
for i, v in pairs(game.Players:GetPlayers()) do
local R = v:FindFirstChild("Roblox")
if not R == "Start" and i == #game.Players:GetPlayers() then
else if R == "Start" then
local Result = math.Random(1,2)
if Result == 1 then
for i, v in pairs(Players) do
game.Workspace(v.name).CFrame = math.Random(Vector3.new(258 or 248 or 238, 248, 258 or 248 or 238))
end
elseif Result == 2 then
for i, v in pairs (Players) do
game.Workspace(v.name).CFrame = game.Workspace.FloodItis.CFrame
end
end
end
end
end
until #game.Players:GetPlayers() == 0

3 comments
i only just found out how to use code blocks, sorry for the misunderstanding in the last question
I think you can just cahnge the game.Workspace(v.Name) into game.Workspace[v.Name]
I am not putting this as a answer, as I don't know if this is what your 100% looking for. But why don't you try using different parts. Each in a folder with a number. The script will pick a random number, teleport the player to that part.