Hi! I’m trying to track down a person who clicked the button in a SurfaceGui in my market stall. This is a button to donate, only now I can’t find a player somehow, I’ve tried everything and nothing wants to work.
This is the script (it’s a serverscript in the button in the surfacegui):
local promptEvent = game:GetService("ReplicatedStorage"):WaitForChild("Stall"):WaitForChild("Donate")
script.Parent.MouseButton1Click:Connect(function()
local character = script.Parent.Parent
local player = Players:GetPlayerFromCharacter(character)
if not player then
print("Geen speler gevonden")
return
end
local assetId = script.Parent.Asset.Value
promptEvent:FireClient(player, assetId)
print("Fired voor:", player.Name)
end)
local button = workspace.Part.SurfaceGui.TextButton -- CHANGE THIS TO YOUR BUTTON LOCATION
button.MouseButton1Click:Connect(function()
local assetId = button.Asset.Value
-- HANDLE THE PROMPTEVENT LOGIC HERE
end)
That doesn’t work for me. It is with me that you claim a stand, then you can put an assetID (dev-product) in a textbox via an edit-menu to then create a button in the surfacegui, so it is actually always a :clone() whereby the button does not exist yet, until it is created. See attachment how the button looks.
Once the data is sent, the “Donations” will be copied and placed in the scrolling frame with the assetID as the name.