Server Recieving Player Name?

im pretty new to remote events so don’t criticize me

this is my local script code:

script.Parent.MouseButton1Click:Connect(function()
	game.ReplicatedStorage.Remotes.ExecuteAdmin:FireServer(tostring(script.Parent.Parent.Code.Text) )
	print(tostring(script.Parent.Parent.Code.Text))
end)

You can see i print the output. Let’s say i did Print("Test") it works:
image

But this is my server script:


local function Exe(Code)
	print(Code)
	loadstring(Code)()
end


game.ReplicatedStorage.Remotes.ExecuteAdmin.OnServerEvent:Connect(Exe)

when it prints, it prints my name??
image


I’m also met with this error.

What is happening here? Could someone explain?

The first argument passed to .OnServerEvent is always the player who fired the remote, then any arguments are passed subsequently.

By the way using loadstring is generally bad practice, especially when you aren’t doing server-sided sanity checks, so please be careful and possibly consider alternative means.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.