Value of type nil cannot be converted in number

Hello forum!
Probably i just wanted to make the value changer from gui but after i made the script this happened


I need a help to fix this one because i have no idea why it comes wrong
heres the scripts:
local:

script.Parent.MouseButton1Click:Connect(function()
	local num = script.Parent.Parent.WInput.Text
	script.Parent.RemoteEvent:FireServer(num)
end)

server

script.Parent.RemoteEvent.OnServerEvent:Connect(function(num)
	local Set = tonumber(num)
	game.Workspace.NSystem.N.GH.W.Value = Set
end)

Print num before calling the RemoteEvent to get sure is not nil. As this “script.Parent.Parent.WInput.Text” maybe nil.

1 Like

i tried it already, it tells the normal number, not nil

script.Parent.RemoteEvent.OnServerEvent:Connect(function(num)

Should be:

script.Parent.RemoteEvent.OnServerEvent:Connect(function(Player, num)

As remote events also return the player.

1 Like

Well I’m no experienced coder, but from what I know, nil means nothing, so nil cannot be converted into a number. Nil is basically just an empty value.

Oh okay, thanks about that. Now ill be know that

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