Help on Marketplace Script; Surface Gui Button

I am trying to make a claim, does anyone have an idea on how I could find the player that activated the surface gui’s textbutton?

Here is the script. Remember ALL help is appreciated :slight_smile: .

-- Variables
local CollectionService = game:GetService("CollectionService")
local MarketplaceService = game:GetService("MarketplaceService")

-- Sign loop
for _, sign in CollectionService:GetTagged("Sign") do
	if sign:IsA("Model") and sign:GetAttribute("Id") then
		local signButton = sign:FindFirstChild("Sign"):FindFirstChild("SurfaceGui"):FindFirstChild("Sign")
		
		if signButton and signButton:IsA("TextButton") then
			signButton.MouseButton1Click:Connect(function()
				
			end)
		end
	end
end

Thank you :slight_smile: :pray: !

It’s pretty easy to attempt this all on the server, but in reality it’s a bad practice. Here’s what I recommend:

  1. Move this code into a local script on the client, so you know you’re only working with the local player
  2. Make a remote event (this will be our link to the server)
  3. Add code in the local script that will fire that remote, which will send the signal to the server
  4. Make a server script and have that script listen in on when that remote event gets fired
  5. Write your marketplace code in the server script. You will have a reference to the player since the remote will always pass the player as the first argument when listening on the server.

Edit: I wrote this assuming this is all in a server script, just let me know if that’s not the case! :+1:

1 Like

Thank you so much Locard you are the best!

1 Like

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