So, I'm creating a system like Roblox Anti-Exploit/Roblox Developer Services, and I have a RemoteFunction
inReplicatedStorage
called 'Call'.
Here's the code from my ModuleScript
:
function callESAE(name,id,desc) local rep = 'yay' --http stuff yeye --Insert trello API code --responce if rep == 'yay' then sendMsg("Call System","Your call to ESAE has been sent.\nPlease wait, an agent will be with you shortly.",player,true) --title, body, player, canClose elseif rep == 'l01a was here' then sendMsg("Call System","You allready have a pending EASE call.\nYour call has not been sent.",player,true) --title, body, player, canClose elseif rep == 'bad boi' then sendMsg("Call System","You have been banned from calling ease.\nYour call has not beens sent.",player,true) --title, body, player, canClose elseif rep == 'crosstect is here' then sendMsg("Call System","The game you are playing has been blacklisted from calling ESAE.\nYour call has not been sent.",player,true) --title, body, player, canClose else sendMsg("Call System","An unkown error has occoured, please contact ElmEditor.\nYour call has not been sent.",player,true) --title, body, player, canClose end end -- function alert.OnClientInvoke(player,desc) callESAE(player,desc) end
And here is the code in my local script (I have defined what theRemoteFunction
is with WaitForChild
)
reqframe.Submit.MouseButton1Click:connect(function() local reason = reqframe:WaitForChild("Reason") cevent:InvokeClient(tostring(reason.Text)) --This is line 267 end)
And here's the error:
10:18:39.781 - Unable to cast value to Object 10:18:39.781 - Script 'Players.Player.PlayerGui.ES_CmdUtl.Client', Line 267 10:18:39.782 - Stack End
I'll assume that sendMsg
is a proxy to some other API call. Which is a bit confusing, because you shouldn't need the player
unless it's on the server. You also appear to be hiding a lot of your code and you're missing the parts which are erroring.
You're only passing 2 arguments to callESAE
, however callESAE
appears to have 3 parameters. Not only that, but your arguments don't appear to match up to the parameters. You're also calling sendMsg
with some nil arguments, as the variables used in the arguments don't appear to be defined at the time of reference.
In all, there's a lot wrong with this, and there's not nearly enough to solve this. Get the right code, and we can have a look.
(Psst, you need a Player as the first argument to InvokeClient)