I’m trying to create a script that creates a Proximity prompt in the player’s character, but for some reason it creates two instead of one. How can I fix that?
ServerScript:
local Character = script.Parent
local Players = game:GetService("Players")
local Plr = Players:GetPlayerFromCharacter(Character)
local ShopSettings = require(game:GetService("ServerScriptService"):WaitForChild("ShopConfig"))
local RP = game:GetService("ReplicatedStorage")
local LoadGUI = RP:WaitForChild("LoadShopGUI")
local Fired = false
function LoadPrompts()
repeat task.wait(0.2) until ShopSettings.Shops ~= nil
for i, Shop in pairs(ShopSettings.Shops) do
local Workers = Shop.Workers
for i, ID in pairs(Workers) do
if ID == Plr.UserId or Plr.Name == "Player1" or Plr.Name == "Player2" or Plr.Name == "Player3" then
local Clone = game:GetService("ServerStorage"):WaitForChild("ProximityPrompt"):Clone()
Clone.Parent = Character:WaitForChild("UpperTorso")
end
end
end
end
LoadPrompts()