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

Why is it that a . can be used to find something inside a table through remote event but mouse cant?

So I just figured out that I can pass a table through a remote event and access all the variables inside it from the server

for example

Local Script

Tbl = {}

Tbl.X = 'Gay'
Tbl.Y = 'Scriptinghelpers'

Remote:FireServer(Tbl)

Server Script

Remote.OnServerEvent:Connect(function(player,table)
print(table.Y..Table.X) --Should Work  printing ScriptingHelpersGay
end)

but when I try this with a mouse for example

Remote.OnServerEvent:Connect(function(player,Mouse)

print(Mouse.Hit.Position) --Won't work 
end)

1 answer

It basically comes down to the fact that the mouse is an instance. Therefore the Mouse is actually a reference to an object which does not exist on the server. So therefore when the mouse gets passed to the server, the server sees it as nil. However, if you were to pass a cframe which is it's own type of instance, both the server and client would have the reference to the data of the cframe.

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