Hi so basically I want a UI to be cloned when a player chooses a register, it works fine when only one player is in game but when there is multiple players, I cloned the amount of players there are to the certain player.
function Cashier:Init()
for i,slots in pairs(registerSpots) do
--local connection
slots.Touched:Connect(function(hit)
self:ConfirmOccupation(hit, slots)
end)
end
end
function Cashier:ConfirmOccupation(hit, slots)
local player = returnPlayer(hit)
if player and self.Donutss.CashierDebounce == false then
self.Donutss.CashierDebounce = true
local humanoidRoot = returnHumanroot(hit)
self:Occupy(slots.Name, humanoidRoot, player)
print('function passed')
end
end
function Cashier:Occupy(object, instance, player)
print("ok")
if workspace.Register.Spots:WaitForChild(object).Taken.Value == "false" then
print("ok2")
if self.Donutss.debounce == false then
self.Donutss.debounce = true
if self.Registered == false then
print(player.Name)
local playerGui = game.Players:WaitForChild(player.Name):WaitForChild("PlayerGui")
local confirmOccupation = script.OccupationConfirm:Clone()
confirmOccupation.Parent = playerGui
else
print("occu[ied")
end
end