#remote events
19 messages · Page 1 of 1 (latest)
so i am practising remoteevents and i have a local script:
local Name = "XG"
local Age = 15
local Gender = "Male"
local rep = game:WaitForChild("ReplicatedStorage")
local remote = rep:FindFirstChild("Remote")
print("Local: ", Name, Age, Gender)
wait(20)
remote:FireServer(Name,Age,Gender)
and this is my serverscript:
local rep = game:WaitForChild("ReplicatedStorage")
local remote = rep:FindFirstChild("Remote")
remote.OnServerEvent:Connect(function(Name,Age,Gender)
if Name and Age and Gender then
print("Got the Players Info In the Server!")
print("Player Info:","Name: ",Name,"Age: ",Age,"Gender: ",Gender)
end
end)
and this is what i exactly got in the output:
21:31:00.628 Local: XG 15 Male - Client - LocalScript:6
21:31:20.655 Got the Players Info In the Server! - Server - Script:7
21:31:20.657 Player Info: Name: XGUSER Age: XG Gender: 15 - Server - Script:8
the XGUSER behind Age is my roblox user --not the real one but it printed my user there
i dont understand why it is not in the correct way outputted?
and why did it print my user?
When practicing with an API member that you're not familiar with, it's best to visit the documentation for that API member. You'll find that Roblox sends the Player instance of the client that fired RemoteEvent:FireServer to the RemoteEvent.OnServerEvent callbacks as their first argument, followed by the arguments passed to FireServer
@inland quarry
but idk what the docu for that is
It's a trivial Google search
i kinda do know how remote events works
"Kinda" doesn't suffice
but i dont understand why it printed my user
then i do know how remote events work
I just explained it. Read the documentation for more details
ok
yea i just found out, both thx for yal help i forgot the first is indeed player mb
but quik question all i said is Name did it really get automatic get the Player.Name?
then how
ah, i see
i understand now thx
if available, print invokes the __tostring metamethod of tables/userdatas for a more user-friendly representation of the data