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

Remote event function issues, tried everything?

Asked by 5 years ago
Edited 5 years ago
    Events.RebirthEvent.OnServerEvent:connect(function(p)
        local Data = Storage.GetData(p.UserId)
            if Data.Fuel >= 1000 then
                local Trails = Data.Trails
                Data.Rebirths = Data.Rebirths +1
                Data.Speed = Data.Speed +1
                Data.Fuel = Data.Fuel -1000 
    end
    end)

ERROR: 22:47:09.223 - ServerScriptService.Events:62: attempt to compare number with table

--Other events that work
    Events.Trailsahundred.OnServerEvent:connect(function(p,cmd, trail)
        local Data = Storage.GetData(p.UserId)
        if cmd  == 'Buy' then
            if Data.Coins >= 250 and not FindTrail(Data.Trails,trail) then
                local Trails = Data.Trails
                table.insert(Data.Trails,{Name = trail})
                Data.Coins = Data.Coins - 250
            end
        elseif cmd == 'Equip' then
            if FindTrail(Data.Trails,trail) then
                Data.EquippedT = trail
            end
        end
    end)

Not sure how to fix this. :/

0
There is no line 62. What line from this snippet is line 62? User#19524 175 — 5y
0
Line 62: if Data.Fuel >= 1000 then MelonRBLX 0 — 5y
0
This doesn't have anything to do with Remotes magicguy78942 238 — 5y
0
It's likely because Data.Fuel is a table. Do post the other scripts containing this. User#19524 175 — 5y
0
Posted above MelonRBLX 0 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

There's a line that you wrote:

local Data = Storage.GetData(p.UserId)

You wrote .GetData instead of :GetAsync(scope) Which is a function and will return a numberic value instead of a table. So instead try to change it to:

local Data = Storage:GetAsync(p.UserId)
0
Hi! Thanks for the help, now I'm getting this: 23:04:48.984 - ServerScriptService.Events:62: attempt to index local 'Data' (a nil value) which I think is worse than before. Line 62 is commented above MelonRBLX 0 — 5y
0
I'm sorry. I edited it again. Try if it works now magicguy78942 238 — 5y
0
Ah, I see...if you see above, I added another part that does indeed work. All I need is to pull a number/value from that users fuel value MelonRBLX 0 — 5y
0
Anyways, that returns this: 23:09:31.953 - ServerScriptService.Events:61: attempt to call method 'GetAsync' (a nil value) MelonRBLX 0 — 5y
0
It happens because you're using something else rather than DataStore magicguy78942 238 — 5y
Ad

Answer this question