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

Why is my script outputting this seemingly random error?

14:57:01.773 - context is not a valid member of Player 14:57:01.773 - Stack Begin 14:57:01.774 - Script 'ServerScriptService.reportControllerServer', Line 11 14:57:01.774 - Stack End 14:57:01.789 - context is not a valid member of Player 14:57:01.790 - Stack Begin 14:57:01.790 - Script 'ReplicatedStorage.reportController', Line 7 - function Bug 14:57:01.790 - Script 'Players.benbebop.PlayerGui.Cover.Report.ReportPrompt.LocalScript', Line 9 14:57:01.791 - Stack End

reportController

local notifController = require(game.ReplicatedStorage.notifController)

local report = {}

function report.Bug(context, errorCode, complaintent)
	local bugReportContent = {}
	bugReportContent["context"] = context
	bugReportContent["errorCode"] = errorCode
	bugReportContent["complaintent"] = complaintent
	game.ReplicatedStorage.clientPipeline.Report.Bug:InvokeServer(bugReportContent)
	notifController.closeReportBugPrompt()
	script.Token:GetAttributeChangedSignal("Value"):Wait(function()
		game.ReplicatedStorage.notifController.NotifStorage.BugReportConfirmation.desc.Text = "Your bug report has been submitted to the system, expect a message if your bug has been adressed. /n/nSubmission Token: " .. script.Token.Value
		notifController.addNotifacation(game.ReplicatedStorage.notifController.NotifStorage.BugReportConfirmation)
	end)
end

function report.Broadcast()
	game.ReplicatedStorage.clientPipeline.Report.Broadcast:InvokeServer()
end

return report

reportControllerServer

local TextService = game:GetService("TextService")

local bugReports = game:GetService("DataStoreService"):GetDataStore("bugReports")

databaseService = require(game.ServerScriptService.DatabaseService)
local globalDatabase = databaseService:GetDatabase("Global")


game.ReplicatedStorage.clientPipeline.Report.Bug.OnServerInvoke = function(bugReportContent)
	local key
	bugReportContent["context"] = TextService:FilterStringAsync(bugReportContent["context"], bugReportContent["complaintent"])
	for i = 0, 499999 do
		if bugReports:GetAsync(i) == nil then
			key = i
			globalDatabase:PostAsync(key, "Complaintent: " .. bugReportContent["complaintent"] .. "/nError: " .. bugReportContent["errorCode"] .. "/nContext: " .. bugReportContent["context"])
			break
		end
	end
	bugReports:SetAsync(key, bugReportContent)
	game.ReplicatedStorage.reportController.Token.Value = key
end

None of any of this has to do with the Player, so I have no idea where this is coming from. complaintent is a UserId but thats it. And most certainly bugReportContent is a dictionary not even close to a Player, what is going on here?

1 answer

✓ Accepted answer

OnServerInvoke() first argument is always the player (which invoked this remote function), weather you like it or not. Just modify like this:

game.ReplicatedStorage.clientPipeline.Report.Bug.OnServerInvoke = function(player,bugReportContent)

Hope this helps!

1 comment

0

That did fix it, but now I got a problem on line 10 of reportController "attempt to concatenate string with Instance". Any idea on whats going on there?

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