local Vehicles = game.ServerStorage.Vehicles
local Rumelt = Vehicles.Humvee
local Spawn = game.Workspace.Game.Vehicle_Spawners.Humvee.Spawner
local GroupId = 33196169
local Rank = 3
Spawn.Activated:Connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player and player:GetRankInGroup(GroupId) >= Rank then
local clone = Rumelt:Clone()
clone.Parent = game.Workspace
clone.Owner.Value = player
if player:GetAttribute("Vehicle") then
player:GetAttribute("Vehicle"):Destroy()
end
player:SetAttribute("Vehicle", clone)
end
end)
game.Players.PlayerAdded:Connect(function(player)
player.TeamChanged:Connect(function(oldTeam, newTeam)
if player:GetAttribute("Vehicle") then
player:GetAttribute("Vehicle"):Destroy()
player:SetAttribute("Vehicle", nil)
end
end)
end)
game.Players.PlayerRemoving:Connect(function(player)
if player:GetAttribute("Vehicle") then
player:GetAttribute("Vehicle"):Destroy()
end
end)
This is my code, I couldn’t find out why it wasn’t spawning the vehicle. I did basic debugging but nothing happened.