Why is this code not working?

Hello,

So I have a surface GUI inside of a part in the workspace. I know this is not very good practice using a server script for a GUI but the only other way I could use a local script is if I had the UI not in the workspace but in the player GUI section and adorne to the part but this is not possible in my case.

I thought it could be an issue with the prompt purchase first but when I put the prints there and it printed nothing I am guessing it is the problem with the mouse button click. I don’t think its an issue with the server script cuz I tried it with a local script first while I had it in startgui while I forgot I could not do it there but still no luck

Code in server script:

local ButtonClick = script.Parent

local MPS = game:GetService("MarketplaceService")

ButtonClick.MouseButton1Click:Connect(function(plr)

print("Runs!")

print(plr.Name)

MPS:PromptPurchase(plr, script.Parent.AssetID.Value)

end)

Shows what happen when I click:

Make the script a local one and place it inside StarterCharacterScripts/StarterPlayerScripts & reference the SurfaceGui from there.

I can’t like I stated in the post. I am creating a donation sign and from my knowledge if I do that it will only update on my client not someone elses one. Thats why I was gonna do it server side.

Also even when I did that before but with the script in the playerGui it still did not work

By the way this is what it looks like:

image

image