Problem with in game purchase of UGC limited

Trying to set it up and getting this error
image

I have a part (“Buyer”) with the proximity prompt in the workspace
image

“GiveLimitedItem” RemoteEvent in replicated storage
image

the server’s purchase script in ServerScriptService
image

and

the proximity prompt checker in StartPlayerScripts
image
(I noticed “Player” was underlined in red, could that be a problem? I also removed the other “end)” because that was giving me an error as well)

some edits. Try this:

repeat task.wait() until game.Workspace:FindFirstChild("Buyer")
local ProximityPrompt = game.Workspace.Buyer.ProximityPrompt

local RemoteEvent = game.ReplicatedStorage.GiveLimitedItem


ProximityPrompt.Triggered:Connect(function(Player)
     if Player == game.Players.LocalPlayer then
          RemoteEvent:FireServer() 
     end
end)

Error is gone but no prompt, Did i do something wrong with where I placed the rest of the scripts and stuff?

Did you wait 60 seconds?

According to UGCs to prompt a limited item, a user must be in game for 60 seconds. If you want, you could disable the prompt and re-enable it on the client when those 60 seconds are up. Here is an example:

repeat task.wait() until game.Workspace:FindFirstChild("Buyer")
local ProximityPrompt = game.Workspace.Buyer.ProximityPrompt
local RemoteEvent = game.ReplicatedStorage.GiveLimitedItem


ProximityPrompt.Enabled = false
task.wait(65)
ProximityPrompt.Enabled = true


ProximityPrompt.Triggered:Connect(function(Player)
     if Player == game.Players.LocalPlayer then
          RemoteEvent:FireServer() 
     end
end)

Oh I completely forgot about the 60 seconds xd, my bad. It seems to be working now. Thank you!

Don’t have anyone to test if the purchase actually goes through since I already own the item but once I get someone to figure that out i’ll update the post as solved.

1 Like