How to get the player from MouseButton1Click event?

I want to get the player from MouseButton1Click event but I don’t know how to do it. I want to use FireClient in the script but I can’t get the player.

game.StarterGui.ScreenGui.TextButton.MouseButton1Click:Connect(function(clicked)
    game.ReplicatedStorage.Tutorial:FireClient(?)
end)

This script is in ServerScriptService.

What should I put instead of “?” ?

Thanks for helping.

You don’t use a server script to handle UI. You can just make this all a LocalScript under the button, and then do

local Players = game:GetService("Players")

local client = Players.LocalPlayer -- you got the player

script.Parent.Activated:Connect(function()
	-- do something with player (start the tutorial)
end)
4 Likes