Tonumber() Stays as string

saveChange:InvokeServer("Position", tonumber(selectedPart.Name), selectedPart.Position)
	function saveChange.OnServerInvoke(editingPlayer, id, property, value)
		if editingPlayer == player then
			print(player, id, property, value, type(id)) -- Output: Ashk3000 Position 1 -5.001445770263672, 0, 0 string
			
			saveData[saveNumber][id][property] = value
			saveInstances[id][property] = value
		end
	end

I am having an issue where I am using tonumber() but type() shows it is still a string. I also get this error

ServerScriptService.SaveData:69: attempt to index nil with number
on both lines where it saves the value. please help.

What is the value of selectedPart.Name is it a number in the first place? Or does the part do exist on the server-side?

Oh oops, I cot confused when making the function properties.

1 Like

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