Remote event firing twice after firing once the first time, need help

like this, im not sure why it should start it. it does everything up until (no errors)

connection = ReplicatedStorage.Remotes.Tycoon_Function_Remotes.OfficialGameRemote.OnClientEvent:Connect(function(player)
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

		-- Connection to handle game start
		connection = ReplicatedStorage.Remotes.Tycoon_Function_Remotes.OfficialGameRemote.OnClientEvent:Connect(function(player)
1 Like

While I was reading the script, I noticed something important:

Since this script is a LocalScript, the random value will be different for each player. Essentially, there’s a chance that it will say that a team has won the coin flip, but other players will see that they lost


@TwlxsDev

I also noticed that, due to how the OfficialGameRemote is being used, it can be replaced by a BindableEvent, since in this case, the server is just firing it to the same player without adding data

1 Like

this is all client sided, i added this for only the player to see. The game is a football franchise game where the player generally is the Owner of a football team, this is just a fun little simulation for the player to be more involved.

2 Likes

Something i noticed @HolyGenki is it prints when the button is clicked and nothing after the connection take a look:

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("clicked")

		-- Connection to handle game start
		connection = ReplicatedStorage.Remotes.Tycoon_Function_Remotes.OfficialGameRemote.OnClientEvent:Connect(function(player)
			print("connection1")

output only printed clicked

1 Like

can you ensure the server script is properly firing the OfficialGameRemote event to the client.

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local OfficialGameRemote = ReplicatedStorage.Remotes.Tycoon_Function_Remotes.OfficialGameRemote

OfficialGameRemote.OnServerEvent:Connect(function(player)
    print("Server received event from:", player.Name)
    OfficialGameRemote:FireClient(player) -- Fire back to the client
end)

I want to say if that connection not printing it most likely has something to do with the server side event firing

1 Like

it does not print that it fires.

1 Like

As silly as it may sound insert this before using the remote in both client and server
print(ReplicatedStorage.Remotes.Tycoon_Function_Remotes.OfficialGameRemote)

i can’t count the times i renamed something or something super silly then spent hours trying to figure out why it doesn’t work XD

It could also be something silly like not loading in fast enough for what ever reasons,
local OfficialGameRemote = ReplicatedStorage:WaitForChild(“Remotes”):WaitForChild(“Tycoon_Function_Remotes”):WaitForChild(“OfficialGameRemote”)

Not always a fan of waitForChild
 But it has saved me a ton. Usually id say aim for FindFirstChild.

2 Likes

1 Like

I did that still no luck, Is the problem is that it does not fire to the server when I click the button?, if we put a fire server to the officalgameremote will it work essentially?

1 Like

we can try to simplify this for testing

MainFrame.Gamestart.Yes.MouseButton1Click:Connect(function()
    if buttonClicked then return end
    buttonClicked = true

    print("Sending event to server")
    ReplicatedStorage.Remotes.Tycoon_Function_Remotes.OfficialGameRemote:FireServer()
end)

ReplicatedStorage.Remotes.Tycoon_Function_Remotes.OfficialGameRemote.OnClientEvent:Connect(function(player)
    print("Event received on client from:", player.Name)
end)
OfficialGameRemote.OnServerEvent:Connect(function(player)
    print("Server received event from:", player.Name)
    OfficialGameRemote:FireClient(player)
end)
1 Like

So once i clicked to start it it printed 2 connection1 print statements starting the beginning of the cutscene but the cutscene has duplicated frames and everything

1 Like

Can you re send me the script so i can see any changes that have been made?

1 Like

I will send you the whole entire code and the code that just corelates to that part.

1000 lines of code of every client sided function in my game including the gamestart

--// Services 
local Players = game:GetService("Players")
local Workspace = game:GetService("Workspace")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local SoundService = game:GetService("SoundService")
local TweenService = game:GetService("TweenService")
--// Variables
local Click = SoundService:WaitForChild("Click")
local Camera = Workspace.CurrentCamera
local ClickUI = SoundService.ClickSound
local ErrorUI = SoundService.Error
local CameraShaker = require(ReplicatedStorage:WaitForChild("CameraShaker"))
--// Remotes
local TycoonRemotes = ReplicatedStorage:WaitForChild("Remotes"):WaitForChild("Tycoon_Function_Remotes")
--// Player Data
local LocalPlayer = Players.LocalPlayer
--local TeamName = LocalPlayer.Team.Name
local PlayerGui = LocalPlayer.PlayerGui
	--// Player UI
	local Computer = PlayerGui:WaitForChild("Computer")
		local Leave = Computer:WaitForChild("leave")
	local TutorialText = PlayerGui:WaitForChild("Player").Dialog
	--local SurfaceGui = LocalPlayer.PlayerGui:WaitForChild(TeamName)
		--local exit = SurfaceGui:WaitForChild("MainFrame").Exit
	local TextBox = PlayerGui:WaitForChild("Player").TextBox
	local TextButton = PlayerGui:WaitForChild("Player").TextButton
	
local GameSFX = SoundService:WaitForChild("Gameday")
local CrowdAw = GameSFX:WaitForChild("CrowdAw")
local CrowdCheer = GameSFX:WaitForChild("CrowdCheer")


local teams = {
	"Arizona Cats ",
	"Atlanta Ducks",
	"Baltimore Crows",
	"Buffalo Stingers",
	"Carolina Reapers"	,
	"Chicago Polars",
	"Cinncinati Bagels",
	"Cleveland Dogs",
	"Dallas Horses",
	"Denver Suns",
	"Detriot Lazers",
	"Green Bay Slackers",
	"Houston Flyers",
	"Indianapolis Jokers",
	"Jacksonville Jacks",
	"Kansas City Reefs",
	"Las Vegas Players",
	"Los Angeles Lambs",
	"Los Angeles Phone Chargers",
	"Miami Fishermen",
	"Minnesota Stockings",
	"New England Geese",
	"New Orleans Skys",
	"New York Lightning ",
	"New York Pancakes ",
	"Philadelphia Birds ",
	"Pittsburgh Burgalers ",
	"San Francisco 21ers ",
	"Seattle Crowns ",
	"Tampa Bay Buckeyes ",
	"Tennessee Thunder ",
	"Washington Skinners"

}

local randomteam = teams[math.random(1, #teams)] 



local StadiumAmbience = SoundService.Gameday["Stadium Ambience"]


local FadeFrame = PlayerGui:WaitForChild("Board_UI"):WaitForChild("FadeFrame")

local function BlurTween()
	FadeFrame.Visible = true
	local TweenService = game:GetService("TweenService")
	local Frame = FadeFrame --This is the variable for the image. Change it if needed.
	local TweenInfo = TweenInfo.new(
		3, -- Time
		Enum.EasingStyle.Linear, -- EasingStyle
		Enum.EasingDirection.Out, -- EasingDirection
		0, -- RepeatCount (when less than zero the tween will loop indefinitely)
		false, -- Reverses (tween will reverse once reaching it's goal)
		0 -- DelayTime
	)
	local tween = TweenService:Create(Frame, TweenInfo, {BackgroundTransparency = 0})
	tween:Play() --Plays the tween
end


local function UnBlurTween()
	FadeFrame.Visible = true
	local TweenService = game:GetService("TweenService")
	local Frame = FadeFrame --This is the variable for the image. Change it if needed.
	local TweenInfo = TweenInfo.new(
		3, -- Time
		Enum.EasingStyle.Linear, -- EasingStyle
		Enum.EasingDirection.Out, -- EasingDirection
		0, -- RepeatCount (when less than zero the tween will loop indefinitely)
		false, -- Reverses (tween will reverse once reaching it's goal)
		0 -- DelayTime
	)
	local tween = TweenService:Create(Frame, TweenInfo, {BackgroundTransparency = 1})
	tween:Play() --Plays the tween
end


--// Functions
local function shakecam(shakeCf)
	Camera.CFrame = Camera.CFrame * shakeCf
end
local renderPriority = Enum.RenderPriority.Camera.Value + 1
local CamShake = CameraShaker.new(renderPriority, shakecam)

local function typewrite(object, text)
	for i = 1, #text, 1 do
		object.Text = string.sub(text, 1, i)
		Click:Play()
		wait(0.08)
	end
end
--// Camera Functions
local function CameraNormal()
	local camera = Workspace.CurrentCamera
	camera.CameraType = Enum.CameraType.Custom
end
--// Code
TycoonRemotes.CamRemoteTest.OnClientEvent:Connect(function(TeamName)
	local Tycoon = Workspace:WaitForChild("Tycoon").Tycoons:WaitForChild(TeamName)
	local Camera = Workspace.CurrentCamera
	Camera.CameraType = Enum.CameraType.Scriptable
	
	local CamTweenPC = TweenService:Create(Camera,TweenInfo.new(
		1,
		Enum.EasingStyle.Quad,
		Enum.EasingDirection.In),
		{
			CFrame = Tycoon:WaitForChild("PurchasedObjects").Office.ComputerCam.CFrame
		})

	CamTweenPC:Play()
	
--	Camera.CFrame = Tycoon:WaitForChild("PurchasedObjects").Office.ComputerCam.CFrame
	
	Leave.Visible = true 
		Leave.MouseButton1Up:Connect(function(plr)
			local Humanoid = LocalPlayer.Character.Humanoid
			Humanoid:ChangeState(Enum.HumanoidStateType.Jumping)

			Leave.Visible = false
			CameraNormal()
		end)
	
	
--	PlayerGui.Computer.MainFrame.Visible = true
	--local Text = script.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Dialogue.TextLabel
	--typewrite(Text, "Welcome to the "..TeamName.." Tycoon!")
	--wait(2)
	--typewrite(Text, "This is where you can purchase items to help you survive!")
	--wait(2)
	--typewrite(Text, "You can also purchase")
	--local CamTest = Workspace:WaitForChild("Tycoon").Tycoons.TeamName:WaitForChild("Purchases"):WaitForChild("WorkArea").ComputerCam
	--CamTest.Transparency = 0

end)

--exit.MouseButton1Click:Connect(function(plr)
--	print("hi")
--end)

TycoonRemotes.Exit.OnClientEvent:Connect(function(plr)
	CameraNormal()
end)
--// TweenService Variables

--local TweenInf = TweenInfo.new(5, Enum.EasingStyle.Quad, Enum.EasingDirection.In, 1)

ReplicatedStorage.Remotes.Tycoon_Function_Remotes.StartTutorial.OnClientEvent:Connect(function(TeamName)
	print("Tutorial in progress")
	--// START TUTORIAL
	local CameraFolder = Workspace.Tycoon.Tycoons:WaitForChild(TeamName).Essentials.TutorialCameras
	
	--//Camera1
	--Camera.CFrame = CameraFolder.Camera1.CFrame
	Camera.CameraType = Enum.CameraType.Scriptable
	local CamTween = TweenService:Create(Camera,TweenInfo.new(
		3,
		Enum.EasingStyle.Quad,
		Enum.EasingDirection.In),
		{
			CFrame = CameraFolder.Camera1.CFrame
		})

	CamTween:Play()
	CamTween.Completed:Wait()
	typewrite(TutorialText, "Welcome to the journey of building your dream football franchise!")
	task.wait(3)
	--//Camera2
	--Camera.CFrame = CameraFolder.Camera2.CFrame
	
	local CamTween2 = TweenService:Create(Camera,TweenInfo.new(
		3,
		Enum.EasingStyle.Quad,
		Enum.EasingDirection.In),
		{
			CFrame = CameraFolder.Camera2.CFrame
		})

	CamTween2:Play()
	CamTween2.Completed:Wait()
	
	Camera.CameraType = Enum.CameraType.Scriptable
	typewrite(TutorialText, "Inside, you can access the computer and other things to upgrade your franchise, team, players and staff!")
	--Camera.CFrame = CameraFolder.Camera2.CFrame
	task.wait(3)
	--// Camera 3
	--Camera.CFrame = CameraFolder.Camera3.CFrame
	Camera.CameraType = Enum.CameraType.Scriptable
	
	local CamTween3 = TweenService:Create(Camera,TweenInfo.new(
		3,
		Enum.EasingStyle.Quad,
		Enum.EasingDirection.In),
		{
			CFrame = CameraFolder.Camera3.CFrame
		})

	CamTween3:Play()
	CamTween3.Completed:Wait()
	
	typewrite(TutorialText, "We have started your dream franchise with this decent team and alright football field")
	--Camera.CFrame = CameraFolder.Camera2.CFrame
	task.wait(3)
	
	Camera.CameraType = Enum.CameraType.Scriptable

	local CamTween4 = TweenService:Create(Camera,TweenInfo.new(
		3,
		Enum.EasingStyle.Quad,
		Enum.EasingDirection.In),
		{
			CFrame = CameraFolder.Camera4.CFrame
		})

	CamTween4:Play()
	CamTween4.Completed:Wait()

	typewrite(TutorialText, "Here is your gameplan board, where you can upgrade your run and pass game along side starting your current weeks game.")
	--Camera.CFrame = CameraFolder.Camera2.CFrame
	task.wait(3)
	
	--// Camera 4
	--Camera.CFrame = CameraFolder.Camera4.CFrame
	Camera.CameraType = Enum.CameraType.Scriptable
	local CamTween5= TweenService:Create(Camera,TweenInfo.new(
		3,
		Enum.EasingStyle.Quad,
		Enum.EasingDirection.In),
		{
			CFrame = CameraFolder.Camera5.CFrame
		})

	CamTween5:Play()
	CamTween5.Completed:Wait()
	 
	--Camera.CFrame = CameraFolder.Camera2.CFrame
	typewrite(TutorialText, "Now to start your franchise, choose your own team name!")
	task.wait(2)
	--//
	TextBox.Visible = true
	TextButton.Visible = true
	
	TextButton.MouseButton1Up:Connect(function(player)
		local TeamName1 = TextBox.Text
		if TeamName1 ~= nil then
			TextButton.Visible = false
			TextBox.Visible = false
			typewrite(TutorialText, "Nice choice! "..TeamName1.." is a great name!")
			ReplicatedStorage.Remotes.UIRemotes.TeamPicked:FireServer(TeamName1)
			task.wait(2)
			Camera.CameraType = Enum.CameraType.Custom
			Camera.CameraSubject = LocalPlayer.Character.Humanoid
			TextButton.Visible = false
			TextBox.Visible = false
			TutorialText.Visible = false
			end
	end)
	
	ReplicatedStorage.Remotes.Tycoon_Function_Remotes.EndTutorial:FireServer(LocalPlayer)
	
end)

ReplicatedStorage.Remotes.Tycoon_Function_Remotes.UpdateSigns.OnClientEvent:Connect(function(plr)
	local TeamName  =LocalPlayer.ValuesGame.TeamName.Value
	ReplicatedStorage.Remotes.Tycoon_Function_Remotes.UpdateSigns:FireServer(TeamName)
end)

ReplicatedStorage.Remotes.Tycoon_Function_Remotes.Pedestrian1.OnClientEvent:Connect(function(player)
	ReplicatedStorage.Remotes.Tycoon_Function_Remotes.Pedestrian1:FireServer(player)
end)

--// WHITE BOARD ACTIONS
local BoardUI = LocalPlayer.PlayerGui:WaitForChild("Board_UI")
local MainFrame = BoardUI.MainFrame
local PassFrame = MainFrame.PassFrame:GetChildren()
local PassF = MainFrame.PassFrame
local RunF = MainFrame.RunGame
local RunFrame = MainFrame.RunGame:GetChildren()

local PassGameValue = LocalPlayer:WaitForChild("ValuesGame").Team.PassGame
local RunGameValue = LocalPlayer:WaitForChild("ValuesGame").Team.RunGame

local Winrate = MainFrame.WinRate
local PracticeStatus = MainFrame.PracticeStatus

--local PassAttributeCost = MainFrame.PassPurchase.AttributeCost

--PassAttributeCost.Value *= PassGameValue.Value
local CurrentPassCost = LocalPlayer.ValuesGame.Team.PassGameCost.Value

MainFrame.PassPurchase.PurchaseLabel.Text = "Purchase 1 Pass Attribute For ".. CurrentPassCost .. " Cash?"

--//Buttons and stuff
local Exit = MainFrame.Exit

ReplicatedStorage.Remotes.UIRemotes.UI_BoardStart.OnClientEvent:Connect(function(TeamName)
	local Tycoon = Workspace:WaitForChild("Tycoon").Tycoons:WaitForChild(TeamName)
	local Board =  Tycoon.PurchasedObjects.Office.Whiteboard
	local BoardCam = Board.BoardCamera
	local PlayerName = LocalPlayer.Name
	local Owner = Tycoon.TycoonInfo.Owner
	if Owner.Value.Name == PlayerName then
	Camera.CameraType = Enum.CameraType.Scriptable
	--// Some Presets
	MainFrame.TeamName.Text = LocalPlayer.ValuesGame.TeamName.Value
	--// Labels
	--//
	local CamTweenBoard = TweenService:Create(Camera,TweenInfo.new(
		1,
		Enum.EasingStyle.Quad,
		Enum.EasingDirection.In),
		{
			CFrame = BoardCam.CFrame
		})
	SoundService.Chalk:Play()
	CamTweenBoard:Play()
	CamTweenBoard.Completed:Wait()
	MainFrame.Visible = true
	end
end)



local mainExit = nil
local mainPass = nil
local mainPassPurch = nil
local mainPassDecline = nil
local mainRun = nil
local mainRunPurch = nil
local mainRunDecline = nil
local playercustom = nil

local startgame = nil
local startgamedecline = nil
local actualstartgame = nil



ReplicatedStorage.Remotes.UIRemotes.UI_BoardStart.OnClientEvent:Connect(function(TeamName, ...) -- Every time this event fires
	if mainExit then mainExit:Disconnect() end
	if mainPass then mainPass:Disconnect() end
	if mainPassPurch then mainPassPurch:Disconnect() end
	if mainPassDecline then mainPassDecline:Disconnect() end
	if mainRun then mainRun:Disconnect() end
	if mainRunPurch then mainRunPurch:Disconnect() end
	if mainRunDecline then mainRunDecline:Disconnect() end
	if playercustom then playercustom :Disconnect() end
	
	if startgame then startgame:Disconnect() end
	if startgamedecline then startgamedecline:Disconnect() end
	if actualstartgame then actualstartgame:Disconnect() end
	
	
	-- so and so forth

	mainExit = MainFrame.Exit.MouseButton1Click:Connect(function(plr, ...) -- A new connection here will be established (it does not disconnect old connections)
		print(...) -- this will print for every new and pre-existing connection that's been created
		ClickUI:Play()
		MainFrame.Visible = false
		Camera.CameraType = Enum.CameraType.Custom
		Camera.CameraSubject = LocalPlayer.Character.Humanoid
	end)
	mainPass = MainFrame.PassButton.MouseButton1Click:Connect(function(plr, ...)
		ClickUI:Play()
		MainFrame.PassPurchase.Visible = true
		print(...) 
	end)
	mainPassPurch = MainFrame.PassPurchase.Purchase.MouseButton1Click:Connect(function(plr, ...)
		if LocalPlayer.ValuesGame.Team.PassGame.Value >= 10 then
			print("Pass Game Maxed Out")
			MainFrame.PassPurchase.PurchaseLabel.Text = "Your pass attributes are maxed out!"
			task.wait(3)
			MainFrame.PassPurchase.PurchaseLabel.Text = "Purchase 1 Pass Attribute For ".. CurrentPassCost .. " Cash?"
		else
			if LocalPlayer.leaderstats.Cash.Value <= CurrentPassCost then
				ErrorUI:Play()
				MainFrame.PassPurchase.PurchaseLabel.Text = "You cannot afford an attribute!"
				task.wait(3)
				MainFrame.PassPurchase.PurchaseLabel.Text = "Purchase 1 Pass Attribute For ".. CurrentPassCost .. " Cash?"
			else
				ReplicatedStorage.Remotes.Tycoon_Function_Remotes.White_Board.PurchasePassAttribute:FireServer(CurrentPassCost,TeamName)
				print("" ..LocalPlayer.Name.. " Purchased an attribute for ".. CurrentPassCost ..    "")
				MainFrame.PassPurchase.Visible = false
				SoundService.PurchaseCompleted:Play()
				--	MainFrame.PassPurchase.Visible = false
			end
		end
	end)
	mainPassDecline = MainFrame.PassPurchase.Decline.MouseButton1Click:Connect(function(plr, ...)
		ClickUI:Play()
		MainFrame.PassPurchase.Visible = false
	end)
	mainRun = MainFrame.RunButton.MouseButton1Click:Connect(function(plr, ...)
		ClickUI:Play()
		MainFrame.RunPurchase.Visible = true
	end)
	mainRunPurch = MainFrame.RunPurchase.Purchase.MouseButton1Click:Connect(function(plr, ...)
		if LocalPlayer.ValuesGame.Team.RunGame.Value >= 10 then
			print("Pass Game Maxed Out")
			MainFrame.RunPurchase.PurchaseLabel.Text = "Your run attributes are maxed out!"
			task.wait(3)
			MainFrame.RunPurchase.PurchaseLabel.Text = "Purchase 1 Run Attribute For ".. CurrentPassCost .. " Cash?"
		else
			if LocalPlayer.leaderstats.Cash.Value <= CurrentPassCost then
				ErrorUI:Play()
				MainFrame.RunPurchase.PurchaseLabel.Text = "You cannot afford an attribute!"
				task.wait(3)
				MainFrame.RunPurchase.PurchaseLabel.Text = "Purchase 1 Run Attribute For ".. CurrentPassCost .. " Cash?"
			else
				ReplicatedStorage.Remotes.Tycoon_Function_Remotes.White_Board.PurchaseRunAttribute:FireServer(CurrentPassCost,TeamName)
				print("" ..LocalPlayer.Name.. " Purchased an attribute for ".. CurrentPassCost ..    "")
				MainFrame.RunPurchase.Visible = false
				SoundService.PurchaseCompleted:Play()
				--	MainFrame.PassPurchase.Visible = false
			end
		end
	end)
	mainRunDecline = MainFrame.RunPurchase.Decline.MouseButton1Click:Connect(function(plr, ...)
		ClickUI:Play()
		MainFrame.RunPurchase.Visible = false
	end)
	playercustom = MainFrame.CustomizeTeam.MouseButton1Click:Connect(function(plr, ...)
		ClickUI:Play()
		--LocalPlayer.PlayerGui.Player_Customization.NextButton.Visible = true
		MainFrame.Visible = false
		TycoonRemotes.Player_Customization.StartEvent:FireServer(TeamName)
		
	end)
	
	startgame = MainFrame.StartGame.MouseButton1Click:Connect(function(plr, ...)
		ClickUI:Play()
		MainFrame.Gamestart.Visible = true
	end)

	startgamedecline = MainFrame.Gamestart.Decline.MouseButton1Click:Connect(function(plr, ...)
		ClickUI:Play()
		MainFrame.Gamestart.Visible = false
	end)
	
	local activeConnections = {}
	local buttonClicked = false
	local connection

	-- Function to manage connections
	local function addConnection(conn)
		table.insert(activeConnections, conn)
	end

	local function cleanupConnections()
		for _, conn in ipairs(activeConnections) do
			if conn.Connected then
				conn:Disconnect()
			end
		end
		activeConnections = {}
	end

	-- Function to reset the game state
	local function resetGameState()
		PlayerGui.Player.GameUI.Visible = false
		PlayerGui.Player.Skip.Visible = false
		PlayerGui.Player.Skip.Value.Value = false
		PlayerGui.Player.CoinFlip.Visible = false
		TutorialText.Text = ""
		TutorialText.Visible = false
		buttonClicked = false
	end

	-- Skip Button Logic (connected once)
	local skipConnection

	-- Ensure Skip Button Logic is connected only once
	if not skipConnection then
		skipConnection = PlayerGui.Player.Skip.MouseButton1Click:Connect(function()
			PlayerGui.Player.GameUI.Visible = true
			PlayerGui.Player.Skip.Visible = false
			PlayerGui.Player.Skip.Value.Value = true
			ClickUI:Play()
			typewrite(TutorialText, "")
			TutorialText.Text = ""
			TutorialText.Visible = false
			CameraNormal()
			ReplicatedStorage.Remotes.Tycoon_Function_Remotes.Gametime.StartGame:FireServer()
			SoundService.Gameday:WaitForChild("Spotlights"):Stop()
		end)
		addConnection(skipConnection)
	end

	-- Main Game Logic
	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("Sending event to server")
		ReplicatedStorage.Remotes.Tycoon_Function_Remotes.OfficialGameRemote:FireServer()

		-- Connection to handle game start
		local OfficialGameRemote = ReplicatedStorage:WaitForChild("Remotes"):WaitForChild("Tycoon_Function_Remotes"):WaitForChild("OfficialGameRemote")
		connection = ReplicatedStorage.Remotes.Tycoon_Function_Remotes.OfficialGameRemote.OnClientEvent:Connect(function(player)
			print("connection1")
			if LocalPlayer.ValuesGame.Practice.Value == false and LocalPlayer.ValuesGame.Game.Value == false then
				ClickUI:Play()
				BlurTween()
				MainFrame.Visible = false
				task.wait(5)
				ReplicatedStorage.Remotes.Tycoon_Function_Remotes.Gametime.FetchTeamData:FireServer(player)

				-- Fetch team data logic
				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

					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

					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)

					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)

					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 the game state
						resetGameState()
					end)
					addConnection(flipChangeConnection)
				end)
				addConnection(connection2)
			end
		end)
		addConnection(connection)
	end)

end)

--// [[WHITE BOARD]]
LocalPlayer.ValuesGame.Team.Week.Changed:Connect(function(plr)
	MainFrame.WeekLabel.Text = "Week ".. LocalPlayer.ValuesGame.Team.Week.Value ..""
	MainFrame.StartGame.Text = "Start Week ".. LocalPlayer.ValuesGame.Team.Week.Value.." Game"
	MainFrame.Gamestart.Label.Text = "Are you sure you want to start your week "..LocalPlayer.ValuesGame.Team.Week.Value.." game?"
end)

MainFrame.WeekLabel.Text = "Week ".. LocalPlayer.ValuesGame.Team.Week.Value ..""
MainFrame.StartGame.Text = "Start Week ".. LocalPlayer.ValuesGame.Team.Week.Value.." Game"
MainFrame.Gamestart.Label.Text = "Are you sure you want to start your week "..LocalPlayer.ValuesGame.Team.Week.Value.." game?"

	local function PassLabel()
		if LocalPlayer.ValuesGame.Team.PassGame.Value <= 4 then
			MainFrame.PassLabel1.Text = "Needs work"
			MainFrame.PassLabel1.TextColor3 = Color3.fromRGB(255, 0, 0)
		elseif LocalPlayer.ValuesGame.Team.PassGame.Value >= 5 then
				MainFrame.PassLabel1.Text = "Good"
				MainFrame.PassLabel1.TextColor3 = Color3.fromRGB(0, 255, 0)
		end
	end	
	
	
	local function RunLabel()
	if LocalPlayer.ValuesGame.Team.RunGame.Value <= 4 then
		MainFrame.RunGameLabel2.Text = "Needs work"
		MainFrame.RunGameLabel2.TextColor3 = Color3.fromRGB(255, 0, 0)
	elseif LocalPlayer.ValuesGame.Team.RunGame.Value >= 5 then
		MainFrame.RunGameLabel2.Text = "Good"
		MainFrame.RunGameLabel2.TextColor3 = Color3.fromRGB(0, 255, 0)
	end
end



local function WinRateLoad()
	
if LocalPlayer.ValuesGame.Team.Practice.Value <= 0 then

	PracticeStatus.Text = "Your team probably needs more practice to have a better chance of winning."
	Winrate.Text = "Chance of winning : Low"
	Winrate.TextColor3 = Color3.fromRGB(255, 85, 0)
elseif LocalPlayer.ValuesGame.Team.Practice.Value <= 3 then
	PracticeStatus.Text = "Your team is slightly warmed up."
	Winrate.Text = "Chance of winning : Medium"
	Winrate.TextColor3 = Color3.fromRGB(255, 255, 0)
elseif LocalPlayer.ValuesGame.Team.Practice.Value <= 5 then
	PracticeStatus.Text = "Your team is warmed up."
	Winrate.Text = "Chance of winning : High"
	Winrate.TextColor3 = Color3.fromRGB(0, 255, 0)
elseif LocalPlayer.ValuesGame.Team.Practice.Value <= 11 then

		PracticeStatus.Text = "Your team is very warmed up and ready to play their next game. đŸ”„"
	Winrate.Text = "Chance of winning : Very High"
	Winrate.TextColor3 = Color3.fromRGB(0, 255, 0)
end
end



LocalPlayer.ValuesGame.Team.Practice.Changed:Connect(function(plr)
WinRateLoad()
end)

--[PASS ATTRIBUTES]

--// Pass Attribute Presets



-- this code determines if the attributes color is red or green based on how many attributes they have, in this case the # is 4 so when it is higher than 4 the attributes turn green.
--// PASS ATTRIBUTES

local function CloneAttributes()
	local Cloned_ATT = PassF.Attribute:Clone()
	Cloned_ATT.Parent = PassF
	MainFrame.PassPurchase.PurchaseLabel.Text = "Purchase 1 Pass Attribute For ".. CurrentPassCost .. " Cash?"
	task.wait(1)
end

local function CloneAttributesRun()
	local Cloned_ATT1 = RunF.Attribute:Clone()
	Cloned_ATT1.Parent = RunF
	MainFrame.RunPurchase.PurchaseLabel.Text = "Purchase 1 Run Attribute For ".. CurrentPassCost .. " Cash?"
	task.wait(1)
end

local function OnJoinRefreshPassAttributes()
for i,v in pairs(PassFrame) do
		--CurrentPassCost += 1000
		if v:IsA("Frame") then
			if v.Name == "Attribute" then
				local amnt = PassGameValue.Value --Number of times it will clone
				local n = PassGameValue.Value --how much times
				for i = 1, n do
					local clone = v:clone()
					clone.Parent = PassF;
					
				end
				v:Destroy()
			end
			
		end
	
end



end
local function OnJoinRefreshRunAttributes()
	for i,v in pairs(RunFrame) do
		--CurrentPassCost += 1000
		if v:IsA("Frame") then
			if v.Name == "Attribute" then
				local amnt = RunGameValue.Value --Number of times it will clone
				local n = RunGameValue.Value --how much times
				for i = 1, n do
					local clone = v:clone()
					clone.Parent = RunF;

				end
				v:Destroy()
			end

		end

	end



end

for i,v in pairs(PassFrame) do --// PASS RED AND GREEN ATTRIBUTES
	if v:IsA("Frame") then
		if v.Name == "Attribute" then
			if PassGameValue.Value <= 4 then
				v.Red.Enabled = true
				v.Green.Enabled = false
			elseif PassGameValue.Value >= 4 then
				v.Red.Enabled = false
				v.Green.Enabled = true
			end

		end
	end
end

for i,v in pairs(RunFrame) do --// PASS RED AND GREEN ATTRIBUTES
	if v:IsA("Frame") then
		if v.Name == "Attribute" then
			if RunGameValue.Value <= 4 then
				v.Red.Enabled = true
				v.Green.Enabled = false
			elseif RunGameValue.Value >= 4 then
				v.Red.Enabled = false
				v.Green.Enabled = true
			end

		end
	end
end



PassGameValue.Changed:Connect(function(plr) -- Pass changed
	--CloneAttributes()
	--RefreshPassAttributes()
end)



RunGameValue.Changed:Connect(function(plr) -- Run changed
	--RefreshRunAttributes()
end)



WinRateLoad()
OnJoinRefreshPassAttributes()
PassLabel()
OnJoinRefreshRunAttributes()
RunLabel()

--RefreshRunAttributes()



ReplicatedStorage.Remotes.Tycoon_Function_Remotes.White_Board.PurchasePassAttribute.OnClientEvent:Connect(function(plr)
	
	MainFrame.PassPurchase.Visible = false
	SoundService.PurchaseCompleted:Play()
	MainFrame.PassPurchase.Visible = false
	CloneAttributes()
	PassLabel()
	--CloneAttributes()
	--MainFrame.PassFrame.Attribute:Destroy()
--	RefreshPassAttributes()
end)

ReplicatedStorage.Remotes.Tycoon_Function_Remotes.White_Board.PurchaseRunAttribute.OnClientEvent:Connect(function(plr)

	MainFrame.RunPurchase.Visible = false
	SoundService.PurchaseCompleted:Play()
	MainFrame.RunPurchase.Visible = false
	CloneAttributesRun()
	RunLabel()
	--CloneAttributes()
	--MainFrame.PassFrame.Attribute:Destroy()
	--	RefreshPassAttributes()
end)

ReplicatedStorage.Remotes.Tycoon_Function_Remotes.White_Board.PurchaseNo.OnClientEvent:Connect(function(plr)
	ErrorUI:Play()
	MainFrame.PassPurchase.PurchaseLabel.Text = "You cannot afford an attribute!"
	--task.wait(3)
	--MainFrame.PassPurchase.PurchaseLabel.Text = "Purchase 1 Pass Attribute For ".. CurrentPassCost .. " Cash?"
end)

ReplicatedStorage.Remotes.Tycoon_Function_Remotes.White_Board.PurchaseNo1.OnClientEvent:Connect(function(plr)
	ErrorUI:Play()
	MainFrame.RunPurchase.PurchaseLabel.Text = "You cannot afford an attribute!"
	--task.wait(3)
	--MainFrame.PassPurchase.PurchaseLabel.Text = "Purchase 1 Pass Attribute For ".. CurrentPassCost .. " Cash?"
end)




	
	
--// HOME TOUCHDOWN
ReplicatedStorage.Remotes.Tycoon_Function_Remotes.Gametime.Touchdown.OnClientEvent:Connect(function(plr)

	SoundService.Gameday.CrowdCheer:Play()
	PlayerGui.Player.GameUI.HomeScore.Score.Value += 7
	PlayerGui.Player.GameUI.Context.Text = "Your team scored a touchdown!"
	task.wait(3)
	PlayerGui.Player.GameUI.Context.Text = ""
end)
--// AWAY TOUCHDOWN
ReplicatedStorage.Remotes.Tycoon_Function_Remotes.Gametime.OtherTeamTouchdown.OnClientEvent:Connect(function(plr)
	SoundService.Gameday.CrowdAw:Play()
	PlayerGui.Player.GameUI.AwayScore.Score.Value += 7
	PlayerGui.Player.GameUI.Context.Text = "The other team scored a touchdown!"
	task.wait(3)
	PlayerGui.Player.GameUI.Context.Text = ""
end)

ReplicatedStorage.Remotes.Tycoon_Function_Remotes.Gametime.AnotherPlay.OnClientEvent:Connect(function(plr)
	SoundService.Gameday.CrowdAw:Play()
	PlayerGui.Player.GameUI.Context.Text = "The other team stopped you!"
	task.wait(3)
	PlayerGui.Player.GameUI.Context.Text = ""
end)
ReplicatedStorage.Remotes.Tycoon_Function_Remotes.Gametime.OtherTeamPlayStop.OnClientEvent:Connect(function(plr)
	SoundService.Gameday.CrowdCheer:Play()
	PlayerGui.Player.GameUI.Context.Text = "You stopped the other team from scoring!"
	task.wait(3)
	PlayerGui.Player.GameUI.Context.Text = ""
end)
--// HOME SCORE
PlayerGui.Player.GameUI.HomeScore.Score.Changed:Connect(function(plr)
	PlayerGui.Player.GameUI.HomeScore.Text = PlayerGui.Player.GameUI.HomeScore.Score.Value
end)
--// AWAY SCORE
PlayerGui.Player.GameUI.AwayScore.Score.Changed:Connect(function(plr)
	PlayerGui.Player.GameUI.AwayScore.Text = PlayerGui.Player.GameUI.AwayScore.Score.Value
end)

ReplicatedStorage.Remotes.Tycoon_Function_Remotes.Gametime.NextQuarter.OnClientEvent:Connect(function(plr)
		PlayerGui.Player.GameUI.TimeFrame.Quarter.Value += 1
		
	
end)

PlayerGui.Player.GameUI.TimeFrame.Quarter.Changed:Connect(function(plr)
	if PlayerGui.Player.GameUI.TimeFrame.Quarter.Value == 5 then
		PlayerGui.Player.GameUI.TimeFrame.Text = ""
		ReplicatedStorage.Remotes.Tycoon_Function_Remotes.Gametime.GameOver:FireServer(plr)
	else
		PlayerGui.Player.GameUI.TimeFrame.Text = "Q"..PlayerGui.Player.GameUI.TimeFrame.Quarter.Value..""
		PlayerGui.Player.GameUI.Context.Text = "NEXT QUARTER!"
		task.wait(3)
		PlayerGui.Player.GameUI.Context.Text = ""
	end
end)

ReplicatedStorage.Remotes.Tycoon_Function_Remotes.Gametime.GameOver.OnClientEvent:Connect(function(plr)

	PlayerGui.Player.GameUI.Context.Text = "Game over!"
	task.wait(10)
	-- Game results
	if PlayerGui.Player.GameUI.HomeScore.Score.Value > PlayerGui.Player.GameUI.AwayScore.Score.Value then
		local HomeScoreValue = PlayerGui.Player.GameUI.HomeScore.Score.Value
		PlayerGui.Player.GameUI.Context.Text = "You won!"
		CrowdCheer:Play()
		CamShake:Start()
		TycoonRemotes.Gametime.Gamewon:FireServer(HomeScoreValue)
		CamShake:Shake(CameraShaker.Presets.Explosion)
		task.wait(3)
		PlayerGui.Player.GameUI.Context.Text = ""
		PlayerGui.Player.GameUI.Visible = false
	elseif PlayerGui.Player.GameUI.HomeScore.Score.Value < PlayerGui.Player.GameUI.AwayScore.Score.Value then
		local HomeScoreValue = PlayerGui.Player.GameUI.HomeScore.Score.Value
		PlayerGui.Player.GameUI.Context.Text = "You lost!"
		CrowdAw:Play()
		task.wait(3)
		PlayerGui.Player.GameUI.Context.Text = ""
		PlayerGui.Player.GameUI.Visible = false
		TycoonRemotes.Gametime.Gamelost:FireServer(HomeScoreValue)
	elseif PlayerGui.Player.GameUI.HomeScore.Score.Value == PlayerGui.Player.GameUI.AwayScore.Score.Value then
		PlayerGui.Player.GameUI.Context.Text = "TIE!"
		SoundService.Gameday.fart:Play()
		task.wait(3)
		PlayerGui.Player.GameUI.Context.Text = ""
		PlayerGui.Player.GameUI.Visible = false
	end
	task.wait(3)
	StadiumAmbience:Stop()
end)

just this part

local activeConnections = {}
	local buttonClicked = false
	local connection

	-- Function to manage connections
	local function addConnection(conn)
		table.insert(activeConnections, conn)
	end

	local function cleanupConnections()
		for _, conn in ipairs(activeConnections) do
			if conn.Connected then
				conn:Disconnect()
			end
		end
		activeConnections = {}
	end

	-- Function to reset the game state
	local function resetGameState()
		PlayerGui.Player.GameUI.Visible = false
		PlayerGui.Player.Skip.Visible = false
		PlayerGui.Player.Skip.Value.Value = false
		PlayerGui.Player.CoinFlip.Visible = false
		TutorialText.Text = ""
		TutorialText.Visible = false
		buttonClicked = false
	end

	-- Skip Button Logic (connected once)
	local skipConnection

	-- Ensure Skip Button Logic is connected only once
	if not skipConnection then
		skipConnection = PlayerGui.Player.Skip.MouseButton1Click:Connect(function()
			PlayerGui.Player.GameUI.Visible = true
			PlayerGui.Player.Skip.Visible = false
			PlayerGui.Player.Skip.Value.Value = true
			ClickUI:Play()
			typewrite(TutorialText, "")
			TutorialText.Text = ""
			TutorialText.Visible = false
			CameraNormal()
			ReplicatedStorage.Remotes.Tycoon_Function_Remotes.Gametime.StartGame:FireServer()
			SoundService.Gameday:WaitForChild("Spotlights"):Stop()
		end)
		addConnection(skipConnection)
	end

	-- Main Game Logic
	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("Sending event to server")
		ReplicatedStorage.Remotes.Tycoon_Function_Remotes.OfficialGameRemote:FireServer()

		-- Connection to handle game start
		local OfficialGameRemote = ReplicatedStorage:WaitForChild("Remotes"):WaitForChild("Tycoon_Function_Remotes"):WaitForChild("OfficialGameRemote")
		connection = ReplicatedStorage.Remotes.Tycoon_Function_Remotes.OfficialGameRemote.OnClientEvent:Connect(function(player)
			print("connection1")
			if LocalPlayer.ValuesGame.Practice.Value == false and LocalPlayer.ValuesGame.Game.Value == false then
				ClickUI:Play()
				BlurTween()
				MainFrame.Visible = false
				task.wait(5)
				ReplicatedStorage.Remotes.Tycoon_Function_Remotes.Gametime.FetchTeamData:FireServer(player)

				-- Fetch team data logic
				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

					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

					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)

					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)

					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 the game state
						resetGameState()
					end)
					addConnection(flipChangeConnection)
				end)
				addConnection(connection2)
			end
		end)
		addConnection(connection)
	end)
1 Like

I just noticed in this
a message that was sent

Blockquote

I also noticed that, due to how the OfficialGameRemote is being used, it can be replaced by a BindableEvent, since in this case, the server is just firing it to the same player without adding data

Blockquote

please tell me he still using a RemoteEvent and not Bindable XD im pretty sure bindable unless changed
The client wouldn’t be able to communicate with the server at all, as FireServer and OnServerEvent are methods exclusive to RemoteEvents.

2 Likes

I have never used bindable, how would i make these changes?

1 Like

I’m pretty sure you can’t if its server to client talk. So i don’t recommend it.
all of that script gave me a headache XD defiantly feeling your pain now hahaha
Thats alot of logic with 0 module scripts idk how you doing it with no module script
it would defiantly help optimize this a ton and clear some head space XD

1 Like

I tried my best to understand the code, but I honestly feel as though it’s very complicated for what it’s trying to do (At least, if I understood what it’s attempting to do correctly :sweat_smile:)

Here’s my current understanding of the situation: You want to trigger a cutscene after the player accepts to start week 12, and when the cutscene is playing, a GUI should show up where a coin flip is performed, and depending on the outcome, you wish to play a success cutscene or a fail cutscene

BindableEvents are similar to RemoteEvents, the main difference being that they’re used to communicate between LocalScript to LocalScript, or Server Script to Server Script

Instead of FireClient or FireServer, they use Fire, and instead of OnClientEvent and OnServerEvent, they use Event

But like @HolyGenki said, they can’t be used send data from the client to the server (or vice versa), like RemoteEvents and RemoteFunctions can

I recommended them because it seems redundant to fire a RemoteEvent just for the server to fire it back to the same player, without adding new data that only the server has access to

1 Like

Right, i have never used module scripts so i wouldn’t know what to do, i pretty much hit a dead end here not knowing what other solutions to do to make it so the Ui plays, gets sent to server, plays out the game, finishes, then ends and i can play the next weeks game simple and clean.

Technically speaking, if the game is single player, or entirely client-sided* (or at least this section is running on the client), why does the server need to play out the game?

* Basing this off what you’ve said here:

“I recommended them because it seems redundant to fire a RemoteEvent just for the server to fire it back to the same player, without adding new data that only the server has access to”

this right here XD i defiantly missed this
 Seeing this lets me know i got to go to sleep XD

Since there is no relevant data that’s being sent, he probably doesn’t even need a remote at all. like at all XD

1 Like