local button = script.Parent
local regen = button.Parent:FindFirstChild("Regen")
local allowedTeamName = "UK Police"
local carModelName = "Yamaha Yz65cc"
local debounce = false
function onTouch(hit)
local character = hit.Parent
local humanoid = character:FindFirstChild("Humanoid")
if humanoid and not debounce then
local player = game.Players:GetPlayerFromCharacter(character)
if player and player.Team and player.Team.Name == allowedTeamName then
debounce = true
print("Button pressed by", player.Name)
button.BrickColor = BrickColor.Black()
if regen then
regen.Value = 1
end
local vehiclesFolder = workspace:FindFirstChild("Vehicles")
if vehiclesFolder then
local carTemplate = vehiclesFolder:FindFirstChild(carModelName)
if carTemplate then
local car = carTemplate:Clone()
car.Parent = workspace
local spawnCFrame = button.CFrame + Vector3.new(0, car:GetExtentsSize().Y/2 + 2, 0)
car:PivotTo(spawnCFrame)
else
warn("Car model '"..carModelName.."' not found in Vehicles folder.")
end
else
warn("Vehicles folder not found in Workspace.")
end
task.wait(1)
if regen then
regen.Value = 0
end
task.wait(5)
button.BrickColor = BrickColor.new(104)
debounce = false
end
end
end
button.Touched:Connect(onTouch)