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

How would I cast a table to an argument? Is there another way to do this?

Asked by
parkderp1 105
9 years ago

I'm trying to transfer a table through a function using arguments, but it says "22:51:19.339 - Unable to cast value to Object" This error occurs on line 9 of the script

In a script in Workspace:

_G.ArrestReason={"Test"}
_G.ArrestTime={}
_G.ArrestNum={}
_G.ArrestOfficer={}


ArrestsEvent=script:WaitForChild("TransferArrests")

ArrestsEvent:FireClient(_G.ArrestReason, _G.ArrestTime, _G.ArrestNum, _G.ArrestOfficer)

In a local script:

EventHandler=game.Workspace:WaitForChild("RemoteEventHandler")
TransArrest=EventHandler:WaitForChild("TransferArrests")

TransArrest.OnClientEvent:connect(function(rsn, waitt, off, num)
    print("Invoked")
    print(rsn)
    _G.LocalArrestReason=rsn
    _G.LocalArrestTime=waitt
    _G.LocalArrestOfficer=off
    _G.LocalArrestNum=num
end)

2
Post your code please. Goulstem 8144 — 9y
0
Sorry forgot, but there. parkderp1 105 — 9y
0
I don't understand what you're trying to do with the _G table. Goulstem 8144 — 9y
0
I'm trying to make two global tables, one on the client side and one on the server side. parkderp1 105 — 9y
View all comments (4 more)
0
Well.. the only reason you would be using remoteevents for this is if you had FE on. FE disables client to server communication. The localscript, presumable in the player, is trying to access stuff in the Workspace. Everything is cancelling eachother out so I'm still confused what your goal is lol. Goulstem 8144 — 9y
0
LocalScripts can't access global tables that are created in server scripts... parkderp1 105 — 9y
0
He's trying to transfer the global table to get around that. OP, which line is in which script is causing that error? adark 5487 — 9y
0
Line 3 of the local script parkderp1 105 — 9y

1 answer

Log in to vote
0
Answered by
SurVur 86
9 years ago

:FireClient() takes a player object as its first argument. You'll have to specify the player. Obviously a table is definitely not a player object

0
That's only with :FireServer() parkderp1 105 — 9y
Ad

Answer this question