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 .
-- 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
It’s pretty easy to attempt this all on the server, but in reality it’s a bad practice. Here’s what I recommend:
Move this code into a local script on the client, so you know you’re only working with the local player
Make a remote event (this will be our link to the server)
Add code in the local script that will fire that remote, which will send the signal to the server
Make a server script and have that script listen in on when that remote event gets fired
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!