Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by
Komas19 34
2 years ago

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!

0
Which script is showing the error msg? MattVSNNL 620 — 2y

2 answers

Log in to vote
1
Answered by 2 years ago

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

Ad
Log in to vote
0
Answered by
enes223 327 Moderation Voter
2 years ago

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

Answer this question