The game is not single player but the client is used just for the player to endure the start of their game. Looks like i have to rework this, and the only thing that gets sent to the server is AFTER the cutscenes take place. I’ll rework this the only remote event that should be used is when the cutscenes are over and the players on field play the football game so other players in the server can watch to if they would like.
for now you can probably try something like this
MainFrame.Gamestart.Yes.MouseButton1Click:Connect(function()
if buttonClicked then return end
buttonClicked = true
cleanupConnections() -- Clean up old connections
MainFrame.Gamestart.Visible = false
MainFrame.Visible = false
print("Game started on client")
-- Proceed directly with game logic
if LocalPlayer.ValuesGame.Practice.Value == false and LocalPlayer.ValuesGame.Game.Value == false then
ClickUI:Play()
BlurTween()
MainFrame.Visible = false
task.wait(5)
-- Fetch Team Data (if needed)
ReplicatedStorage.Remotes.Tycoon_Function_Remotes.Gametime.FetchTeamData:FireServer()
-- Listen for team data
local connection2 = ReplicatedStorage.Remotes.Tycoon_Function_Remotes.Gametime.FetchTeamData.OnClientEvent:Connect(function(Teamname)
local GameCameras = Workspace:WaitForChild("Tycoon").Tycoons:WaitForChild(Teamname).Essentials.GamedayCameras
Camera.CameraType = Enum.CameraType.Scriptable
-- Tween to the first game camera
local CamTween1 = TweenService:Create(Camera, TweenInfo.new(3, Enum.EasingStyle.Quad, Enum.EasingDirection.In), {
CFrame = GameCameras.Camera1.CFrame
})
CamTween1:Play()
StadiumAmbience:Play()
CamTween1.Completed:Wait()
TutorialText.Text = ""
TutorialText.Visible = true
UnBlurTween()
task.wait(3)
PlayerGui.Player.Skip.Visible = true
-- Coin Flip Logic
local CoinFlip = PlayerGui.Player.CoinFlip
CoinFlip.Visible = true
-- Heads Logic
local headsConnection = CoinFlip.Heads.MouseButton1Click:Connect(function()
CoinFlip.Visible = false
ClickUI:Play()
local chance = math.random(1, 100)
if chance > 50 then
CoinFlip.Flip.Value = true
CrowdCheer:Play()
TutorialText.Visible = true
typewrite(TutorialText, "It seems the " .. LocalPlayer.ValuesGame.TeamName.Value .. " won the coin toss!")
else
CoinFlip.Flip.Value = true
CrowdAw:Play()
TutorialText.Visible = true
typewrite(TutorialText, "The " .. LocalPlayer.ValuesGame.TeamName.Value .. " lost the coin toss.")
end
end)
addConnection(headsConnection)
-- Tails Logic
local tailsConnection = CoinFlip.Tails.MouseButton1Click:Connect(function()
CoinFlip.Visible = false
ClickUI:Play()
local chance = math.random(1, 100)
if chance > 50 then
CoinFlip.Flip.Value = true
CrowdCheer:Play()
TutorialText.Visible = true
typewrite(TutorialText, "It seems the " .. LocalPlayer.ValuesGame.TeamName.Value .. " won the coin toss!")
else
CoinFlip.Flip.Value = true
CrowdAw:Play()
TutorialText.Visible = true
typewrite(TutorialText, "The " .. LocalPlayer.ValuesGame.TeamName.Value .. " lost the coin toss.")
end
end)
addConnection(tailsConnection)
-- Coin Flip Result
local flipChangeConnection = CoinFlip.Flip.Changed:Connect(function()
task.wait(3)
local CamTween4 = TweenService:Create(Camera, TweenInfo.new(3, Enum.EasingStyle.Quad, Enum.EasingDirection.In), {
CFrame = GameCameras.Camera4.CFrame
})
CamTween4:Play()
typewrite(TutorialText, "The game is underway here at " .. LocalPlayer.ValuesGame.TeamName.Value .. " field!")
task.wait(3)
TutorialText.Visible = false
CameraNormal()
if not PlayerGui.Player.Skip.Value.Value then
ReplicatedStorage.Remotes.Tycoon_Function_Remotes.Gametime.StartGame:FireServer()
PlayerGui.Player.GameUI.Visible = true
PlayerGui.Player.GameUI.TimeFrame.Quarter.Value += 1
end
-- Reset game state
resetGameState()
end)
addConnection(flipChangeConnection)
end)
addConnection(connection2)
end
end)
I do think that reworking this is a good idea, but make sure to get some rest before doing so. I speak from personal experience when I say that sleep deprivation causes you to make some questionable programming decisions which you’ll regret afterwards
Thank you guys for suffering this with me, I’ll work on this tmr, 8 hours of brainless work, but we all learned something i hope. Thank you!
I think that @HolyGenki deserves the solution more than I do, since they’ve been helping you longer than I have
In the end it doesn’t make much of a difference to me, I Just wanted to help. I will probably send him a private chat though on turning some of that to module. recalling the same functions over and over and it is not module is… well you know XD