So basically I hop into a vehicle, everything works fine, but when I hop out and close the GUI, everything shuts off (Lights, siren), and when I hop back into the vehicle the GUI doesn't appear anymore, even after I respawned it, this also happens to the other vehicles.

wait(0.1)
script.Car.CarSeat.Value = script.Parent
Check = {"Rengate"}
Blacklist = {}
GroupID = 0
Main = script.Parent.Parent.Parent
seat = script.Parent
deletetime = 30
cur = nil
script.Parent.ChildAdded:connect(function(it)
	if it:IsA("Weld") then
		local Part = script.Parent.Parent:GetChildren()
		for i = 1, #Part do
			if Part[i].ClassName == "Part" then
				Part[i].Anchored = false
			end
		end
		timerdebounce = false
		tempcur = it.Part1.Parent
		if cur ~= tempcur and cur ~= nil then tempcur.Humanoid.Sit = false return end
		if cur == tempcur then print("same guy!")return end
		print(tempcur.Name)
		done = false
		cur = tempcur
		local Player = game.Players:GetPlayerFromCharacter(cur)
		for _,i in pairs (Check) do
			if i == Player.Name or GroupID > 0 and Player:IsInGroup(GroupID) or GroupID == 0 then
				done = true
				if Player.PlayerGui:findFirstChild("Car") then
					done = false
				end
			end
		end
		for _,i in pairs (Blacklist) do
			if cur.Name == i then
				done = false
			end
		end
		if done == false then
			Player.Humanoid.Jump = true
			cur = nil
			Player = nil
			print(tempcur.Name.." was booted")
			script.Parent.Parent.Parent = Main
			script.Parent.Parent.InUse.Value = false
		else
			script.Car:Clone().Parent = Player.PlayerGui
			script.Parent.Char.Value = Player
			game.Players:GetPlayerFromCharacter(cur).PlayerGui.Car.Frame.Seat.Value = script.Parent
			game.Players:GetPlayerFromCharacter(cur).PlayerGui.Car.Frame.LocalScript.Disabled = false
			script.Parent.Parent.Parent = Main
			script.Parent.Parent.InUse.Value = true
			timerdebounce = false
		end
	elseif it:IsA("IntValue") then
		print("Bye Bye user!")
		cur = nil
		Player = nil
		script.Parent.Parent.Parent = Main
		script.Parent.Parent.InUse.Value = false
		timerdebounce = true
		starttimer()
	end
end)

game.Players.ChildRemoved:connect(function(bye)
	if bye == script.Parent.Char.Value then
		timerdebounce = true
		starttimer()
	end 
end)

script.Parent.ChildRemoved:connect(function(hi)
	if hi:IsA ("Weld") then
		local Part = script.Parent.Parent:GetChildren()
		for i = 1, #Part do
			if Part[i].ClassName == "Part" then
				Part[i].Anchored = true
			end
		end
			if script.Parent.Park.Value == false then
				timerdebounce = true
				starttimer()
			elseif script.Parent.Park.Value == true then
				timerdebounce = false
		end
	end
end)

function starttimer()
	for i = deletetime,0,-1 do
		pcall(function()if i <= 30 then
			script.Parent.Parent.Body.Time.Timeout.TextLabel.Text = i
			script.Parent.Parent.Body.Time.Timeout.Enabled = true
		end end)
		wait(1)
		if not timerdebounce then break end
	end
	pcall(function()
		script.Parent.Parent.Body.Time.Timeout.Enabled = false
	end)
	if timerdebounce then
		wait(0.5)
		script.Parent.Parent:Destroy()
	end
end

2 comments

0

Can we see your script?

0

Updated it! firefoxninja, this is the main script by what I can guess