Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Attempt to compare nil < number . Can someone help me pls?

Remote Event Script

local function buyworlds(player, name, amount)
	local stats = player.leaderstats
	
	if stats.Coins.Value > tonumber(amount) or tonumber(amount) then
		game.Workspace.Worlds[name].AreasBlock.Sides2:Destroy()
		stats.Coins.Value = stats.Coins.Value - amount
		message["Main.World.Buy.Enough"].Visible = true
	else
		message["Main.World.Buy.NotEnough"].Visible = true
	end
end

buyworld.OnServerEvent:Connect(buyworlds)

LocalScript that fires the event

while wait() do
	local worldName = script.Parent.WorldName.Value
	local buyValue = script.Parent.BuyValue.Value
	local plr = game:GetService("Players").LocalPlayer
	game:GetService("ReplicatedStorage").buyWorld:FireServer(plr, worldName, buyValue)
end

Script that shows up the frame

local message = game:GetService("StarterGui").Message["Main.World.Buy"]

function onTouch(part) 
	message.BuyValue.Value = 1000
	message.WorldName.Value = script.Parent.Parent.Parent.Name
	message.Visible = true
end

script.Parent.Touched:connect(onTouch)

Please help!

1 comment

0

Which script is showing the error msg?

2 answers

✓ Accepted answer

When you do fireserver, don’t fire it with the player, it’s automatically added. Shouldn’t have the error anymore once plr is removed

hey you! have you ever heard of enes? if you are in trouble, better call enes!

This discussion is preserved as it was. New answers, comments, and votes are closed.