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!
A better in-sync map preview for my race game.
- What is the issue?
There is some delay with the map. I need you to come see.
- What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I’ve tried putting a coroutine.wrap in the loop so that it’s synchronised better, i’ve tried firing remoteevents and adding more remoteevents for specific timing.
Check out the game and I’ll show you what i mean:… Bloxy Roads - Roblox
code for camera:
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
script.Parent.Parent.Parent.GarageGui.Enabled = false
end)