Trying to set it up and getting this error
![image](//devforum-uploads.s3.dualstack.us-east-2.amazonaws.com/uploads/original/5X/e/7/0/0/e7007fc56cff54425b20c9f30669c7c38f827189.png)
I have a part (“Buyer”) with the proximity prompt in the workspace
![image](/secure-uploads/uploads/original/5X/1/7/e/8/17e8edfe04d6b8e9d0d991e286e0ab1e89f2c727.png)
“GiveLimitedItem” RemoteEvent in replicated storage
![image](/secure-uploads/uploads/original/5X/d/7/a/1/d7a181d96c7bccc9c8edd3e319cb0b1d64bc9ebd.png)
the server’s purchase script in ServerScriptService
![image](/secure-uploads/uploads/original/5X/a/e/b/f/aebf7d63ce27ea1f4260a405b1a471baad85fdd8.png)
and
the proximity prompt checker in StartPlayerScripts
![image](/secure-uploads/uploads/original/5X/f/9/d/7/f9d76eb158dd8ce02d38a1406c39630259064dd1.png)
(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