#Touched cooldown issue
1 messages · Page 1 of 1 (latest)
local Workspace = game:GetService("Workspace")
local lobby = Workspace:WaitForChild("Lobby")
local queueModels = lobby:WaitForChild("QueueModels")
local QueueServiceServer = {}
function QueueServiceServer.init(self: QueueServiceServer)
self.debounce = false
for _, model in ipairs(queueModels:GetChildren()) do
if model.Name == "Thief" or "Police" then
for _, part in ipairs(model:GetChildren()) do
if part.Name == "Hitbox" then
print("Found hitbox!")
part.Touched:Connect(function(hit)
if self.debounce then
return
end
part.Material = Enum.Material.Neon
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
self:queue(hit.Parent)
end
self.debounce = true
task.wait(2)
self.debounce = false
end)
part.touchEnded:Connect(function(hit)
self:leaveQueue(hit.Parent)
self.debounce = false
end)
end
end
end
end
end
function QueueServiceServer.queue(self: QueueServiceServer, character: Model)
print("Queueing player: " .. character.Name)
end
function QueueServiceServer.leaveQueue(self: QueueServiceServer, character: Model)
print("Queue left player: " .. character.Name)
end
type QueueServiceServer = typeof(QueueServiceServer)
return QueueServiceServer