Annoying Error Message

So, I’ve been working on a trade log, with nothing special in particular.
Up until today, I’ve been doing fine with bindable events and functions.

But today, I got this error thrown at me:

Here is my script:

-- alessdai
local httpService = game:GetService("HttpService")
game.ServerScriptService.Functions.TradeLog.Event:Connect(function(plr1,plr2, tbl)
	
	-- Proccess a table to encode
	local trade ={}
	trade.Plyr1 = plr1.Name
	trade.Plyr2 = plr2.Name
	trade.P1Offer ={}
	trade.P2Offer ={}
	
	local numberPog1 = 0
	local numberPog2 = 0
	for i,v in pairs(tbl.Player1Offerings:GetChildren()) do
		table.insert(trade.P1Offer, numberPog1, v.Value)
		numberPog1 = numberPog1 + 1
	end
	
	for i,x in pairs(tbl.Player2Offerings:GetChildren()) do
		table.insert(trade.P2Offer, numberPog2, x.Value)
		numberPog1 = numberPog2 + 1
	end

	local JSONencoded = httpService:JSONEncode(trade)
	local safe = false
	-- Run a security test
	local JSONdecoded = httpService:JSONDecode(JSONencoded)
	if JSONdecoded.Plyr1 ~= trade.Plyr1 then
		-- Instantly assume somehing is wrong
		print("ERROR! Json Decode is not equal to real tbl value!")
	else
		safe = true
	end
	
	-- not done yet
	if safe == true then
		print("yay!")
	end
end)

Does anyone know what’s wrong with my script?
Thanks,
al

P.S. I’m a terrible scripter

1 Like

Just to be clear the TradeLog is the BindableEvent? If not, you’d have to add a :FindFirstChild()

1 Like

TradeLog is the bindable event.

2 Likes

That’s really strange. Could you try parenting your event to ServerStorage instead of ServerScriptService? Also, just to be clear, your script is server-sided, right?

1 Like

Yes, it is.
I’ll try moving it to the ServerStorage, and see if anything has changed.

2 Likes

Okay, your solution worked. I don’t know what was happening before, but it seems perfectly fine now.
Thank you!

No worries!

Yeah, I am 99% sure it’s because only scripts, modulescripts and folders can be parented to ServerScriptService as it’s gray, meaning it won’t work well. Objects that are meant to go there will have their name in white.

Screen Shot 2020-10-11 at 10.35.53 PM Screen Shot 2020-10-11 at 10.36.28 PM

2 Likes