Help sending variable info from server to client gui

I am trying to make a step system through a module script to work with a client gui. Trying to carry the step number I am on from the module script to the gui the fireclient remote event system but i don’t know exactly how to send the info. I am doing as instructed ( Event:FireClient(player, step)). The gui runs but i do not believe the info variable is working. Currently I am trying to change the text of a text label. If i get rid of using the step information the text label will change to the desired string. But if i use a if step == 1 line the text label wont run. I will also be carrying more info for the game to work so i need to fix this FireClient Variable info transfer.

here is my code

module script:

local GamePlay = {}
ReplicatedStorage = game:GetService(“ReplicatedStorage”)
gPlayEvent = ReplicatedStorage.GamePlay
comIntfcEvent = ReplicatedStorage.ComInterface
function GamePlay.StartOn(player, pId)
print(“Start Module”)
step = 1
local plyrNme = player.Name
while wait(0.01) do
print(“start loop”)
if step == 1 then
print(“start step 1”)
local stepInfo = step
comIntfcEvent:FireClient(player, step)
print(" after fire client")
wait(5)
step = 2
elseif step == 2 then
print(“start step 2”)
comIntfcEvent:FireClient(player, step)
end

end

end

return GamePlay


Player Gui Script

local Players = game:GetService(“Players”)
ReplicatedStorage = game:GetService(“ReplicatedStorage”)
gPlayEvent = ReplicatedStorage.GamePlay
comIntfcEvent = ReplicatedStorage.ComInterface

local guiLocation = script.Parent
local abilityGui = guiLocation:WaitForChild(“AbilitiesGui”)
local comIntfc = abilityGui.ComIntfc

function comIntfcOn(player, step)
print(“Player gui”)
if step == 1 then
print(“in if step 1”)
comIntfc.TextLabel.Text = "Greetings "
print(“after text label”)
elseif step == 2 then
comIntfc.TextLabel.Text = “Ready to battle!?”
end
end

comIntfcEvent.OnClientEvent:Connect(comIntfcOn)

Thanks for the Help!

I believe the issue is in the comIntfcOn function.
Your code is expecting that the parameters are the player and the step, however in reality the parameters are just the step. This discrepancy causes step to be nil, and hence doesn’t meet the conditions of the if statement.

Simply replace

function comIntfcOn(player, step)

with

function comIntfcOn(step)

and it should work!


For future posts, can you please put your code inside of codeblocks?
(Put ``` on the line before, and the line after, for it)