The script is inside the VehicleSeat, but I have to sit twice in order for the GUI to show up.
local ui = script.Parent:FindFirstChild("PoliceGUI")
script.Parent.Touched:connect(function(hit)
if hit.Parent ~= nil then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if hit.Parent:FindFirstChild("Humanoid") ~= nil then
hit.Parent.Humanoid.Seated:connect(function(active, seat)
if player ~= nil then
if active == true and seat == script.Parent then
if player.PlayerGui:FindFirstChild("PoliceGUI")== nil then
ui:Clone().Parent = player.PlayerGui
print("seated")
end
elseif active ~= true and seat ~= script.Parent then
if player.PlayerGui:FindFirstChild("PoliceGUI") ~= nil then
player.PlayerGui:FindFirstChild("PoliceGUI"):Destroy()
print("not seated")
end
end
end
end)
end
end
end)

2 comments
It didn't work
What didn't work