You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
Every player needs to be ready at the same time instead of the delays being varied. -
What is the issue? Include screenshots / videos if possible!
Some players are still in the map introduction preview of the race course while others have started the race I think the reason is because the map is very big and takes time to load. So is there like a wait() or some waitforassettoload function that can let the players start in syncrony? -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I’ve tried making a fire server
Server script:
Map.Parent = game:GetService('Workspace')
game.ReplicatedStorage.Status.Value = ''..Map.Name
Map:WaitForChild("Interpolate1")
Map:WaitForChild("Interpolate2")
Map:WaitForChild("Interpolate3")
Map:WaitForChild("Interpolate4")
wait(1)
for Index,Player in pairs(Players) do
coroutine.wrap(function()
if not Player.PlayerGui.Settings.Music:FindFirstChild("Intro") then
local Intro = Map:WaitForChild("Intro"):Clone()
Intro.Parent = Player.PlayerGui.Settings.Music
Intro.Volume = Player.PlayerGui.Settings.Main.Vol.Value
end
if not Player.PlayerGui.Settings.Music:FindFirstChild("Theme") then
local Theme = Map:WaitForChild("Theme"):Clone()
Theme.Volume = Player.PlayerGui.Settings.Main.Vol.Value
Theme.Parent = Player.PlayerGui.Settings.Music
end
if not (Player).Character then table.remove(Players,table.find(Players,Player)) end
local PlayerGui = Player:FindFirstChild('PlayerGui')
if not (PlayerGui) then table.remove(Players,table.find(Players,Player)) end
wait()
ReplicatedStorage.Remotes.PlaySong:FireClient(Player)
end)()
end
for Index,Player in pairs(Players) do
coroutine.wrap(function()
local Folder = ReplicatedStorage:FindFirstChild(Player.UserId)
if not (Folder) then table.remove(Players,table.find(Players,Player)) end
if not (Player).Character then table.remove(Players,table.find(Players,Player)) end
local Character = Player.Character
if not (Character):FindFirstChild('CurrentlyDriving') then
local CD = script.CurrentlyDriving:Clone()
CD.Parent = Character
CD.WhatAmIDriving.Disabled = false
end
local Lap = Character:FindFirstChild('Lap')
local Multipliers = Player:FindFirstChild('HowManyCoinMultipliers')
if (Lap) then
Lap.Value = 0
else
local Object = Create(Character,'IntValue','Lap')
Object.Value = 0
end
local WCHPR = Character:FindFirstChild('WCHPR') -- What Checkpoint Has Player Reached
if (WCHPR) then
WCHPR.Value = 0
else
local CCPP = Create(Character,'IntValue','WCHPR')
CCPP.Value = 0
end
if not (Multipliers) then
local Int = Create(Player,'IntValue','HowManyCoinMultipliers')
Int.Value = 0
end
if (Folder) then
pcall(function()
local Alliance = ReplicatedStorage.Remotes.GetAlliance:Invoke(Player)
ReplicatedStorage.Remotes['Team - Event']:FireClient(Player,Alliance)
Debounces[Player.Name] = false
script.Reward:Clone().Parent = Folder
Character.Head.Anchored = true
local Intro = script["Map Intro Details"]:Clone()
local Frame = Intro.Frame
local Range = GetRange(Players)
Frame['Random advice'].Text = Advice
Frame.RoadLength.Text = "Approximated Road Length ".. Map['Approximated Road Length'].Value .. " studs"
Frame["Win Percent"].Text = tostring('Your chances of making it to the finish line are: '..math.floor(((math.floor(Map["Win Percent"].Value * 10))/10)+0.5).. "%")
Intro.Parent = Player.PlayerGui
Intro.Frame.Tween.Disabled = false
Frame["N° of players and range of levels"].Text = "There are "..#Players.." vehicles starting this race with levels ranging from "..Range[1].. " to "..Range[2]
if game.ReplicatedStorage[Player.UserId]:FindFirstChild("AvgPlacement") then
Frame["Average Place"].Text = "Average place: "..game.ReplicatedStorage[Player.UserId]["AvgPlacement"].Value
end
ReplicatedStorage.Remotes['GUI - Event']:FireClient(Player, false)
ReplicatedStorage.Remotes.Interpolate:FireClient(Player,{
Map.Interpolate1;
Map.Interpolate2;
Map.Interpolate3;
Map.Interpolate4;
})
wait(10)
ReplicatedStorage.Remotes['GUI - Event']:FireClient(Player, false)
local Car = Folder.CurrentCar.Value:Clone()
Car.VehicleSeat.Networkowner.Disabled = false
Car.VehicleSeat.Drive.Disabled = false
Car.Parent = Map
Car:SetPrimaryPartCFrame((Spawnpoints[Index].CFrame) + Vector3.new(0,4.5,0))
print(Car.Name .. " is ready")
Character.Head.Anchored = false
Car.Parent = game:GetService('Workspace')
Car.Owner.Value = Player
game.CollectionService:AddTag(Car, 'Cars')
wait(10)
--[[for i,v in pairs(Character:GetDescendants()) do
if v:IsA("Accessory") then
v.Handle.CanCollide = false
end
if v:IsA("MeshPart") or v:IsA("BasePart") or v:IsA("Handles") or v:IsA("Part") then
v.CanCollide = false
end
if v.Name == "Head" then
v.CanCollide = true
end
end]]
for i,v in pairs(Character:GetDescendants()) do
if v:IsA("BasePart") then
v.Anchored = false
end
end
wait(3)
Character:SetPrimaryPartCFrame(Car.PrimaryPart.CFrame + Vector3.new(0,0.3,0))
local checkmods = false
for i,v in pairs(Car:GetDescendants()) do
if v.Name == "MobilityMod1" or v.Name == "DefenseMod1" or v.Name == "AggressiveMod1" then
checkmods = true
end
end
local mods = script.Modifications:Clone()
mods.Parent = Player.PlayerGui
Intro:Stop()
table.remove(Spawnpoints,1)
end)
end
end)()
end
The client has this:
local screentweenInfo = TweenInfo.new(0.5, Enum.EasingStyle.Linear)
local ContextActionService = game:GetService("ContextActionService")
local FREEZE_ACTION = "freezeMovement"
game:GetService('ReplicatedStorage').Remotes.Interpolate.OnClientEvent:Connect(function(Interpolations)
game.Players.LocalPlayer.PlayerGui.Settings.Music:WaitForChild("Intro"):Play()
game.Players.LocalPlayer.PlayerGui.Settings.Music:WaitForChild("Intro").Volume = game.Players.LocalPlayer.PlayerGui.Settings.Main.Vol.Value * 0.46
local Orig = game.Workspace.CurrentCamera.CFrame
for Index = 1,#Interpolations do
ContextActionService:BindAction(FREEZE_ACTION, function() return Enum.ContextActionResult.Sink end, false,unpack(Enum.PlayerActions:GetEnumItems()))
script.Parent.Parent.Parent.GiveUp.GiveUpHandler.Disabled = true
game.Workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable
game.Workspace.CurrentCamera.CameraSubject = Interpolations[Index]
local screenfade1 = game:GetService("TweenService"):Create(script.Parent, screentweenInfo, {BackgroundTransparency = 0}):Play()
coroutine.wrap(function()
wait(1)
game.Workspace.CurrentCamera.CFrame = Interpolations[Index].CFrame * CFrame.new(Interpolations[Index].CFrame.lookVector)
wait(0.5)
local screenfade1 = game:GetService("TweenService"):Create(script.Parent, screentweenInfo, {BackgroundTransparency = 1}):Play()
end)()
wait(0.5)
coroutine.wrap(function()
if Interpolations[Index]:FindFirstChild("Position") then -- now the camera can move to show around the map
Interpolations[Index]:GetPropertyChangedSignal("Position"):Connect(function()
game.Workspace.CurrentCamera.CFrame = Interpolations[Index].CFrame * CFrame.new(Interpolations[Index].CFrame.lookVector)
end)
local TS = game:GetService("TweenService")
local TweenInfo = TweenInfo.new(4)
local PosTween = TS:Create(Interpolations[Index], TweenInfo, {Position = Interpolations[Index]:FindFirstChild("Position").Value})
PosTween:Play()
end
end)()
coroutine.wrap(function()
if Interpolations[Index]:FindFirstChild("Orientation") then -- now the camera can move to show around the map
Interpolations[Index]:GetPropertyChangedSignal("Orientation"):Connect(function()
game.Workspace.CurrentCamera.CFrame = Interpolations[Index].CFrame * CFrame.new(Interpolations[Index].CFrame.lookVector)
end)
local TS = game:GetService("TweenService")
local TweenInfo = TweenInfo.new(4)
local RotTween = TS:Create(Interpolations[Index], TweenInfo, {Orientation = Interpolations[Index]:FindFirstChild("Orientation").Value})
RotTween:Play()
end
end)()
wait(24 / (#Interpolations))
end
game.ReplicatedStorage.Count:FireServer()
end)
game.ReplicatedStorage.Initiate.OnClientEvent:Connect(function()
ContextActionService:UnbindAction(FREEZE_ACTION)
script.Parent.Parent.Parent.GiveUp.GiveUpHandler.Disabled = false
-- maybe add a wait()
pcall(function()
game.Players.LocalPlayer.PlayerGui:FindFirstChild("Map Intro Details"):Destroy()
end)
local screenfade1 = game:GetService("TweenService"):Create(script.Parent, screentweenInfo, {BackgroundTransparency = 0}):Play()
local screenfade1 = game:GetService("TweenService"):Create(script.Parent, screentweenInfo, {BackgroundTransparency = 1}):Play()
pcall(function()
game.Players.LocalPlayer.PlayerGui.Settings.Music:FindFirstChild("Intro"):Stop()
end)
game.Workspace.CurrentCamera.CameraType = Enum.CameraType.Custom
game.Workspace.CurrentCamera.CameraSubject = game.Players.LocalPlayer.Character.Humanoid
game.Players.LocalPlayer.PlayerGui.Settings.Music:WaitForChild("Theme"):Play()
game.Players.LocalPlayer.PlayerGui.Settings.Music:WaitForChild("Theme").Looped = true
game.Players.LocalPlayer.PlayerGui.Settings.Music:WaitForChild("Theme").Volume = game.Players.LocalPlayer.PlayerGui.Settings.Main.Vol.Value * 0.46
end)
In your experience what errors do you see?