TextButton in Workspace

Hi,

I have a textbutton in the workspace which when a player clicks I want to fire a remote event to the client to remove a part for a single player.

I have it working if I put in a player added but can’t figure out how to get it working when a player clicks the button.

I am getting the error “FireClient: player argument must be a Player object” from the sever script.

Thanks

Could you maybe provide the script? It’s kind of difficult to give feedback if we can’t see what the code looks like.

Are you using a LocalScript or a ServerScript?

Also, FireClient must have the player object.

Assuming it’s in a script with the parent being the TextButton:

script.Parent.MouseButton1Click:Connect(function()
    [YOUR CODE HERE]
end)

The issue here is that you can’t reference the Player that clicked the button if this inside is a SurfaceGui object

Your only option(s) is to either use a ProximityPrompt, or a ClickDetector object in order to reference it that way

You must be trying to fire the client but it needs to be a player

local RemoteEvent = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent")

-- if the first variable isn't a player you will get an error
RemoteEvent:FireClient(player, var1, var2)