Text wont change properly

for some reason INTERMISSION wont go away. no errors. dont see whats wrong
Code + images
LOCAL SCRIPT

game.ReplicatedStorage.Inter.OnClientEvent:Connect(function(intermission, MSG)
	script.Parent.Text = ("INTERMISSION: " .. intermission)
	if MSG then
		script.Parent.Text = (MSG)
	end
end)

Parts of the server

repeat
		wait(1)
		intermission = intermission - 1
		game.ReplicatedStorage.Inter:FireAllClients(intermission)
until intermission == 0

local MSG = "Will you be the creep??" 				----gui
	game.ReplicatedStorage.Inter:FireAllClients(MSG)


local MSG = "Game has ended, preparing intermission" 				----gui
	game.ReplicatedStorage.Inter:FireAllClients(MSG)


You need to pass 2 arguments because you have 2 parameters. Since MSG is your only argument, it’s passed as intermission because that’s the first parameter.

To fix your code, you need to use nil in place of the missing argument. You also need to check if intermission exists.

The adjusted code is below.

LocalScript
game.ReplicatedStorage.Inter.OnClientEvent:Connect(function(intermission, MSG)
	if intermission then
		script.Parent.Text = ("INTERMISSION: " .. intermission)
	elseif MSG then
		script.Parent.Text = (MSG)
	end
end)
Script
repeat
		wait(1)
		intermission = intermission - 1
		game.ReplicatedStorage.Inter:FireAllClients(intermission, nil)
until intermission == 0

local MSG = "Will you be the creep??" 				----gui
	game.ReplicatedStorage.Inter:FireAllClients(nil, MSG)


local MSG = "Game has ended, preparing intermission" 				----gui
	game.ReplicatedStorage.Inter:FireAllClients(nil, MSG)

This should solve your issue.

1 Like

Thanks bro. Didn’t know you had to replace missing arguments!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.