So I send a FireClient() with one argument. Code (server script):

local amountRepaired = script.Parent.Repaired.Value
rpl.UpdateRepair:FireClient(Player, amountRepaired)

I already checked and amountRepaired is not nil. But when this is received through OnClientEvent (local script):

local function onUpdateRepair(amount)
	player.PlayerGui.gui.RepairFrame.Visible = true
	player.PlayerGui.gui.RepairingText.Visible = true
	player.PlayerGui.gui.RepairFrame.Bar.Size = UDim2.new(1/(100/amount), 0, 1, 0)
end

replicatedStorage.HideRepair.OnClientEvent:Connect(onUpdateRepair)

It gives me the error that it can't divide by nil and also when I print amount out it just prints nil. I've been trying to figure this out for a while so if someone can help me with this it would be greatly appreciated.

6 comments

0

oh my god can you please format your code

0

Im sorry i just realized and fixed it. I used the wrong code button

1

those are two different events, one is UpdateRepair and one is HideRepair

0

Oh I have another remote event that is called HideRepair and I forgot to change the name. Stupid mistake. Thank you

0

Idk if I'm supposed to mark it as solved since I can't find somewhere for that but it is.

0

add [solved] to mark as self solved