so basically I took a basic C addition calculator and tried my best to turn it into lua because I want to create an emulator of things like ms-dos and Gameboy (no im not going to link gameboy roms, I own gameboy games therefore I am legally allowed to have roms, also I probably will not use regular gameboy roms, most likely just small print roms or a moving sprite) but anyway in my function I created some int values as it is an int function in C but its not working as in the leaderstats folder doesnt appear

My messy code:

function main()
	
	
	game.ReplicatedStorage.y.OnServerEvent:Connect(function(Player)
	Player.leaderstats.y.Value = tonumber(game.StarterGui.userInterface.y.Text)
	end)
	
	game.ReplicatedStorage.x.OnServerEvent:Connect(function(Player)
	Player.leaderstats.x.Value = tonumber(game.StarterGui.userInterface.x.Text)
	end)
	
	
	game.Players.PlayerAdded:Connect(function(player)
local printf = print
local int = Instance.new("Folder",player)
local x = Instance.new("IntValue",int)
local y = Instance.new("IntValue",int)
local z = Instance.new("IntValue",int)
  int.Name = "leaderstats"
	x.Name = "x"
	y.Name = "y"
	z.Name = "z"
  printf("Enter two numbers to add")

  z.Value = x.Value + y.Value

  printf("Sum of the numbers = " .. z.Value)
	end)
end

	game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(Player)
		main()
	end)

1 comment

0

main returns (IT SHOULD RETURN) 0 and printf prints on the same line and returns the length of the formatted string, just make a C-to-Lua compiler at this point