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

Remote event function issues, tried everything?

	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. :/

5 comments

0

There is no line 62. What line from this snippet is line 62?

0

Line 62: if Data.Fuel >= 1000 then

0

This doesn't have anything to do with Remotes

0

It's likely because Data.Fuel is a table. Do post the other scripts containing this.

0

Posted above

1 answer

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)

5 comments

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

0

I'm sorry. I edited it again. Try if it works now

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

0

Anyways, that returns this: 23:09:31.953 - ServerScriptService.Events:61: attempt to call method 'GetAsync' (a nil value)

0

It happens because you're using something else rather than DataStore

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