local ItemText = script.Parent.Parent.BillboardGui.TextLabel
local Brick = script.Parent.Parent
local RepStore = game.ReplicatedStorage
local Funcs = require(RepStore.Modules:WaitForChild("Funcs"))
local FoodsFolder = RepStore.Foods
-- CONFIGURATION
local Food = 'Taco'
local price = 25
local canrebuy = false
local alreadyowns = false
local getItem = FoodsFolder[Food]
--
ItemText.Text = '$'..price..': '..Food
--
-- Script Functions
Brick.ProximityPrompt.Triggered:Connect(function(plr)
local backpack = plr['Backpack']
local check = backpack:FindFirstChild(Food)
local cash = Funcs:grabCash(plr)
local cloneItem = getItem:Clone()
if check then
Funcs:sendNoti(plr,'You already own..')
elseif not check and cash>=price then
Funcs:removeCash(plr,price)
Funcs:editCashUI(plr)
cloneItem.Parent = backpack
end
end)
The code works when testing on the client-side on studio. However when I try it in a server with multiple players, the tool isnt given to any player that goes up to it and triggers the proximity prompt. (Only works on client, and not on the server)
(The script is a server script inside the proximity prompt.)