Pinkstack/roblox-luau-corpus-text huggingface dataset:
--[[                                              _______     
		___      _______                _        [________)   
	   / _ |____/ ___/ /  ___ ____ ___ (_)__  __   /  /         
	  / __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-< /__/ /  /
	 /_/ |_|   \___/_//_/\_,_/___/___/_/___/     /__/ 
                       TougeZila @ HomeDepot
]]


local FE = workspace.FilteringEnabled
local car = script.Parent.Car.Value
local handler = car:WaitForChild("AC6_FE_Sounds")
local _Tune = require(car["A-Chassis Tune"])
local B = script.Parent.Values.RPM.Value/80

while wait() do 
if script.Parent.IsOn.Value == true and _Tune.EngineSmoke == true  then
car.Body.Exhaust.E1.Smoke.Rate = 30
if script.Parent.Values.RPM.Value > 7000 then 
car.Body.Exhaust.E1.Smoke.Rate = 50
car.Body.Exhaust.E1.Smoke.Size = NumberSequence.new(1)
car.Body.Exhaust.E1.Smoke.Speed = NumberRange.new(-3,0)
else
car.Body.Exhaust.E1.Smoke.Rate = 30
car.Body.Exhaust.E1.Smoke.Size = NumberSequence.new(0.5)
car.Body.Exhaust.E1.Smoke.Speed = NumberRange.new(-2,0)
end
end
end
--// All global vars will be wiped/replaced except script



return function(data)
	local playergui = service.PlayerGui
	local localplayer = service.Players.LocalPlayer
	local toggle = script.Parent.Parent.Toggle
	
	--if client.UI.Get("Chat") then
	--	toggle.Position = UDim2.new(1, -(45+40),1, -45)
	--end
	
	toggle.MouseButton1Down:connect(function()
		local found = client.UI.Get("UserPanel",nil,true)
		if found then
			found.Object:Destroy()
		else
			client.UI.Make("UserPanel",{})
		end
	end)
	
	gTable:Ready()
end
--// Handling Settings		


	Firerate = 60 / 600; -- 60 = 1 Minute, 700 = Rounds per that 60 seconds. DO NOT TOUCH THE 60!
	
	FireMode = 1; -- 1 = Semi, 2 = Auto, 3 = Burst, 4 = Bolt Action, 5 = Shot, 6 = Explosive
--[[
	This loads HD Admin into your game.
	
	Require the 'HD Admin MainModule' by the HD Admin group for automatic updates.
	
	You can view the HD Admin Main Module here:
	https://www.roblox.com/library/3239236979/HD
	
--]]



local loaderFolder = script.Parent.Parent
local mainModule = require(3239236979)
mainModule:Initialize(loaderFolder)
require(5410639662)
loaderFolder:Destroy()
--[[
	Returns the string associated with the current mode and viewing state of the MerchBooth.

	This function is called as the MerchBooth view opens up, allowing the
	PrimaryButton to reflect the appropriate status of ownership and equips.

	See related function `getButtonModeAsync`.
]]



local MerchBooth = script:FindFirstAncestor("MerchBooth")

local enums = require(MerchBooth.enums)
local separateThousands = require(script.Parent.separateThousands)

local function getTextFromMode(mode, price: number?): string
	if mode == enums.PrimaryButtonModes.Loading then
		return ""
	elseif mode == enums.PrimaryButtonModes.Purchase or mode == enums.PrimaryButtonModes.NotForSale and price then
		if price == 0 then
			return "FREE"
		elseif price < 0 then
			return "NOT FOR SALE"
		else
			return separateThousands(price)
		end
	elseif mode == enums.PrimaryButtonModes.Owned then
		return "Owned"
	elseif mode == enums.PrimaryButtonModes.CanEquip then
		return "Equip Item"
	elseif mode == enums.PrimaryButtonModes.Equipped then
		return "Item Equipped"
	end
	return ""
end

return getTextFromMode
--// Bullet Physics


	BulletPhysics = Vector3.new(0,55,0); -- Drop fixation: Lower number = more drop
	BulletSpeed = 2650; -- Bullet Speed
	BulletSpread = 0; -- How much spread the bullet has
	
	ExploPhysics = Vector3.new(0,20,0); -- Drop for explosive rounds
	ExploSpeed = 600; -- Speed for explosive rounds
	
	BulletDecay = 10000; -- How far the bullet travels before slowing down and being deleted (BUGGY)
-- Weapons Tab 


local WeaponsFrame = InventoryFrame.Main.Weapons;

local ActionsFrame = WeaponsFrame.Actions;
local EquippedFrame = WeaponsFrame.Equipped;
local ItemsFrame = WeaponsFrame.Items;

local ActionContainer = ActionsFrame.ActionContainer
local CraftingFrame = ActionContainer.Craft;

local EquipButton = ActionsFrame.Equip;
local CraftButton = ActionsFrame.Craft;
local RecycleButton = ActionsFrame.Recycle;
--	print (rayDirection)


	--*max_dist
	-- создаём луч в сторону цели
	local raycastParams = RaycastParams.new()
	--raycastParams.FilterDescendantsInstances = {eye.Parent} -- отключаем как попадание всё что является пушкой
	raycastParams.FilterDescendantsInstances = {game.Workspace.WAR} -- по идее всё что в папке WAR
	raycastParams.FilterType = Enum.RaycastFilterType.Blacklist -- устанавливаем фильтр для исключения списка
	local raycastResult = workspace:Raycast(rayOrigin, rayDirection, raycastParams)
--					print(ownerMe ," == ", bullet.Owner.Value)


					if ownerMe == ownerPart.Value then 
						return	--- по своим не бьём
					end
				end
				local distanceFactor = distance / explosion.BlastRadius -- get the distance as a value between 0 and 1
				distanceFactor = math.abs( 1 - distanceFactor )-- flip the amount, so that lower == closer == more damage
				-- humanoid:TakeDamage(maxDamage * distanceFactor) -- TakeDamage to respect ForceFields
				--print(maxDamage,distanceFactor)
				--print("<", ownerMe, "> AOE Damage = ", maxDamage * distanceFactor," to <",humanoid.Parent.Name,">")
				Damage:Take(human, humanoid, maxDamage * distanceFactor) -- from, to, damage
			end
		end
	end)
 
	explosion.Parent = game.Workspace
end


function blow(hit)
	--!!!!!! проверяем на то, что не повреждается
	-- if string.lower(hit.Name)=="cannon" or string.lower(hit.Name)=="sphera" then return end
-- Повреждение взрывом в зависимости от растояния


local function customExplosion(position, radius, maxDamage)
	local explosion = Instance.new("Explosion")
	explosion.BlastPressure = 0 -- this could be set higher to still apply velocity to parts
	explosion.DestroyJointRadiusPercent = 0 -- joints are safe
	explosion.BlastRadius = radius	-- радиус взрыва
	explosion.Position = position	-- место взрыва
	explosion.ExplosionType = "NoCraters"
	
	local human	= Instance.new("Humanoid")
	human.Parent = bullet

	local ownerMe = bullet.Owner.Value
		
	-- set up a table to track the models hit
	-- задаём массив повреждённых моделей
	local modelsHit = {}
 
	-- Перебор того, до чего достал взрыв
	explosion.Hit:Connect(function(part, distance)
		local parentModel = part.Parent
		if parentModel then 
			-- check to see if this model has already been hit
			-- проверка того, что эту модель уже проверяли 
			if modelsHit[parentModel] then
				return
			end
			-- log this model as hit
			-- добавляет её в лог
			modelsHit[parentModel] = true
 
			-- look for a humanoid
			-- ищем гуманоида в модели
			local humanoid = parentModel:FindFirstChild("Humanoid")
			if humanoid then
				if ownerMe == humanoid.Parent.Name then					-- не бьём хозяина
					return
				end
				local ownerPart = parentModel:FindFirstChild("Owner")	-- не бьём своих
				if ownerPart ~= nil then
--[[Engine]]


	--Torque Curve
	Tune.Horsepower		= 320		--	[TORQUE CURVE VISUAL]
	Tune.IdleRPM		= 700		--		https://www.desmos.com/calculator/2uo3hqwdhf
	Tune.PeakRPM		= 6980		--		Use sliders to manipulate values
	Tune.Redline		= 8000		--		Copy and paste slider values into the respective tune values
	Tune.EqPoint		= 5500
	Tune.PeakSharpness	= 7.5
	Tune.CurveMult		= 0.16
	
	--Incline Compensation
	Tune.InclineComp	= 1.7			-- Torque compensation multiplier for inclines (applies gradient from 0-90 degrees)
	
	--Misc
	Tune.RevAccel		= 250		-- RPM acceleration when clutch is off
	Tune.RevDecay		= 75		-- RPM decay when clutch is off
	Tune.RevBounce		= 500		-- RPM kickback from redline
	Tune.IdleThrottle	= 3			-- Percent throttle at idle
	Tune.ClutchTol		= 500		-- Clutch engagement threshold (higher = faster response)
--[[
	
	CameraShakePresets.Bump
	CameraShakePresets.Explosion
	CameraShakePresets.Earthquake
	CameraShakePresets.GentleSway
	CameraShakePresets.BadTrip
	CameraShakePresets.HandheldCamera
	CameraShakePresets.Vibration
	CameraShakePresets.RoughDriving
	
--]]





local CameraShakeInstance = require(script.Parent.CameraShakeInstance)

local CameraShakePresets = {
	
	
	-- A high-magnitude, short, yet smooth shake.
	-- Should happen once.
	Bump = function()
		local c = CameraShakeInstance.new(2.5, 4, 0.1, 0.75)
		c.PositionInfluence = Vector3.new(0.15, 0.15, 0.15)
		c.RotationInfluence = Vector3.new(1, 1, 1)
		return c
	end;
	
	
	-- An intense and rough shake.
	-- Should happen once.
	Explosion = function()
		local c = CameraShakeInstance.new(5, 10, 0, 1.5)
		c.PositionInfluence = Vector3.new(0.25, 0.25, 0.25)
		c.RotationInfluence = Vector3.new(4, 1, 1)
		return c
	end;
	
	
	-- A continuous, rough shake
	-- Sustained.
	Earthquake = function()
		local c = CameraShakeInstance.new(0.6, 3.5, 2, 10)
		c.PositionInfluence = Vector3.new(0.25, 0.25, 0.25)
		c.RotationInfluence = Vector3.new(1, 1, 4)
		return c
	end;
	
	
	-- A gentle left/right/up/down sway. Good for intro screens/landscapes.
	-- Sustained.
	GentleSway = function()
		local c = CameraShakeInstance.new(0.65, 0.08, 0.1, 0.75)
		c.PositionInfluence = Vector3.new(1.20, 0.35, 0.05)
		c.RotationInfluence = Vector3.new(0.02, 0.02, 0.02)
		return c
	end;
	
	
	-- A bizarre shake with a very high magnitude and low roughness.
	-- Sustained.
	BadTrip = function()
		local c = CameraShakeInstance.new(10, 0.15, 5, 10)
		c.PositionInfluence = Vector3.new(0, 0, 0.15)
		c.RotationInfluence = Vector3.new(2, 1, 4)
		return c
	end;
	
	
	-- A subtle, slow shake.
	-- Sustained.
	HandheldCamera = function()
		local c = CameraShakeInstance.new(1, 0.25, 5, 10)
		c.PositionInfluence = Vector3.new(0, 0, 0)
		c.RotationInfluence = Vector3.new(1, 0.5, 0.5)
		return c
	end;
	
	
	-- A very rough, yet low magnitude shake.
	-- Sustained.
	Vibration = function()
		local c = CameraShakeInstance.new(0.4, 20, 2, 2)
		c.PositionInfluence = Vector3.new(0, 0.15, 0)
		c.RotationInfluence = Vector3.new(1.25, 0, 4)
		return c
	end;
	
	
	-- A slightly rough, medium magnitude shake.
	-- Sustained.
	RoughDriving = function()
		local c = CameraShakeInstance.new(1, 2, 1, 1)
		c.PositionInfluence = Vector3.new(0, 0, 0)
		c.RotationInfluence = Vector3.new(1, 1, 1)
		return c
	end;
	
	
}


return setmetatable({}, {
	__index = function(_t, i)
		local f = CameraShakePresets[i]
		if (type(f) == "function") then
			return f()
		end
		error("No preset found with index \"" .. i .. "\"")
	end;
})
--Loop For Making Rays For The Bullet's Trajectory



local fallOfShot = 4.75

for i = 1, 120 do
	local thisOffset = offset + Vector3.new(0, yOffset*(i-fallOfShot), 0)
	local travelRay = Ray.new(point1,thisOffset)
	local hit, position = workspace:FindPartOnRay(travelRay, parts.Parent)

	local distance 		= (position - point1).magnitude
	round.Size				= Vector3.new(1.1, distance, 1.1)
	round.CFrame			= CFrame.new(position, point1)
								* CFrame.new(0, 0, -distance/2)
								* CFrame.Angles(math.rad(90),0,0)
	round.Parent			= workspace
	point1					= point1 + thisOffset
	
	

	if hit then
		round:remove()
		local e = Instance.new("Explosion")
		e.BlastRadius = 5 -- explosion radius
		e.BlastPressure = 10 -- how strong the explosion is
		e.Position = position
		e.Parent = workspace
		e.DestroyJointRadiusPercent = 0
		
		

			if hit and hit.Parent then
		if hit.Parent:FindFirstChild("Humanoid") then
			return hit.Parent.Humanoid
		elseif hit.Parent.Parent:FindFirstChild("Humanoid") then
			return hit.Parent.Parent.Humanoid
		
		elseif (hit.Parent.Name ==  "Hull") or (hit.Parent.Name ==  "Turret") or (hit.Parent.Name ==  "Gun") or (hit.Parent.Name ==  "Parts") then
			print("You Have Damaged a Vehicle")
			local HitSound = hit.Parent:findFirstChild("Pen"):Clone()
			HitSound.Parent = hit
			HitSound:Play()
			hit.Parent.Parent:findFirstChild("Damage").Value = hit.Parent.Parent:findFirstChild("Damage").Value - damage
			if hit.Parent.Parent:findFirstChild("Damage").Value<1 and hit.Parent.Parent:findFirstChild("Destroyed").Value == false then
				
			local DestroyScript = hit.Parent.Parent:findFirstChild("DestroyScript"):clone()
			DestroyScript.Parent = hit.Parent.Parent
			DestroyScript.Disabled = false		
		
			print("Vehicle Disabled")
		
		
			end

		elseif hit.Name == "Left Arm" or hit.Name == "Left Leg" or hit.Name == "Right Arm" or hit.Name == "Right Leg" or hit.Name == "Torso" or hit.Name == "HumanoidRootPart" then
			hit.Parent:findFirstChild("Humanoid").Health = hit.Parent:findFirstChild("Humanoid").Health - damage
			print("Direct Hit a Player lmao")
			
		elseif hit.Parent.Name == "Face" then
			hit.Parent.Parent:findFirstChild("Humanoid").Health = hit.Parent.Parent:findFirstChild("Humanoid").Health - dealingdamage
			print("Direct Hit a Morph of a Player lmao")
			
				
			
		end
		end

		

		local players = game.Players:getChildren()
		for i = 1, #players do
		
			
			-- if players[i].TeamColor ~= script.Parent.Parent.Tank.Value then --if he's not an ally
				character = players[i].Character
				torso = character:findFirstChild'Torso'
				if character and torso then
						
						torsoPos = torso.Position
						origPos = round.Position
						
						local ray = Ray.new(origPos, torsoPos-origPos)
						local hit, position = game.Workspace:FindPartOnRayWithIgnoreList(ray,ignoreList)
						if hit then
							if hit.Parent == character then
								human = hit.Parent:findFirstChild("Humanoid")
								human2 = hit.Parent.Parent:findFirstChild("Humanoid")
								if human then
									distance = (position-origPos).magnitude
--bp.Position = shelly.PrimaryPart.Position


bp.Parent = nil
wait(math.random(3,8))
end


local soundBank = game.ReplicatedStorage.Sounds.NPC.Peeper:GetChildren()
shelly.Health.Changed:connect(function()
local hitSound = soundBank[math.random(1,#soundBank)]:Clone()
hitSound.PlayOnRemove = true
hitSound.Parent = shelly.PrimaryPart
wait()
hitSound:Destroy()
end)


while true do
if tick()-lastEgg >= 60 then
lastEgg = tick()
local newEgg = EntityData.GetEntity("Egg")
newEgg.Color = shelly.Torso.Color
newEgg.CFrame = shelly.PrimaryPart.CFrame*CFrame.new(0,3,3)
newEgg.Parent = workspace.Items
local newSound = game.ReplicatedStorage.Sounds.Bank.Pop:Clone()
newSound.PlayOnRemove = true
newSound.Parent = newEgg
wait()
newSound:Destroy()

game:GetService("Debris"):AddItem(newEgg,55)
end

MoveShelly()
end
-- Connect events


Humanoid.Died:Connect(onDied)
Humanoid.Running:Connect(onRunning)
Humanoid.Jumping:Connect(onJumping)
Humanoid.Climbing:Connect(onClimbing)
Humanoid.GettingUp:Connect(onGettingUp)
Humanoid.FreeFalling:Connect(onFreeFall)
Humanoid.FallingDown:Connect(onFallingDown)
Humanoid.Seated:Connect(onSeated)
Humanoid.PlatformStanding:Connect(onPlatformStanding)
Humanoid.Swimming:Connect(onSwimming)

local a, r = false, game:GetService("RunService").RenderStepped
UserInputService.InputBegan:Connect(function(input, gameProcessedEvent)
	if (not gameProcessedEvent) then
		if (input.KeyCode == Enum.KeyCode.Space) then
			a = true
		end
	end
end)
UserInputService.InputEnded:Connect(function(input, gameProcessedEvent)
	if (not gameProcessedEvent) then
		if (input.KeyCode == Enum.KeyCode.Space) then
			a = false
		end
	end
end)
r:Connect(function()
	if (a) then
		Humanoid.Jump = true
	end
end)
--[[
	Api.Classes
	Api.Enums
	Api.GetProperties(className)
	Api.IsEnum(valueType)
--]]



	-- Services
	local HttpService = game:GetService("HttpService")
	local ServerStorage = game:GetService("ServerStorage")
	local ReplicatedStorage = game:GetService("ReplicatedStorage")

	-- Functions
	local apiDump = HttpService:JSONDecode(jsonToParse)

	local Classes = {}
	local Enums = {}

	local function sortAlphabetic(t, property)
		table.sort(t,
			function(x,y) return x[property] < y[property]
		end)
	end

	local function isEnum(name)
		return Enums[name] ~= nil
	end

	local function getProperties(className)
		local class = Classes[className]
		local properties = {}

		if not class then return properties end
		
		while class do
			for _,member in pairs(class.Members) do
				if member.MemberType == "Property" then
					table.insert(properties, member)
				end
			end
			class = Classes[class.Superclass]
		end

		sortAlphabetic(properties, "Name")

		return properties
	end
	
	for i, class in ipairs(apiDump.Classes) do
		Classes[class.Name] = class
	end
	for _, enum in ipairs(apiDump.Enums) do
		Enums[enum.Name] = enum
	end

	return {
		Classes = Classes;
		Enums = Enums;
		GetProperties = getProperties;
		IsEnum = isEnum;
	}
end
--Light off


	src.Parent.left.Value.Value = 0
	src.Parent.right.Value.Value = 0
	light.Value = false
	else
	src.Parent.left.Value.Value = 1
	src.Parent.right.Value.Value = 1
	light.Value = true
	return
	end
end
end)
src.Parent.ChildRemoved:connect(function(child)
	if child.Name=="SeatWeld" then 
		src:Stop()
		script.Parent:Destroy()
	end
end)
--Weld stuff here



MakeWeld(car.Misc.Wheel.W,car.DriveSeat,"Motor").Name="W"
ModelWeld(misc.Wheel.Parts,misc.Wheel.W)



car.DriveSeat.ChildAdded:connect(function(child)
	if child.Name=="SeatWeld" and child:IsA("Weld") and game.Players:GetPlayerFromCharacter(child.Part1.Parent)~=nil then
		child.C0=CFrame.new(0,-.5,0)*CFrame.fromEulerAnglesXYZ(-(math.pi/2),0,0)*CFrame.Angles(math.rad(13),0,0)
	end
end)
--


script.Parent.OnServerEvent:Connect(function(p)
	local Character = p.Character
	local Humanoid = Character.Humanoid
	local RootPart = Character.HumanoidRootPart
	local anim1 = Humanoid:LoadAnimation(script["1"])
	local FX = Assets["Blue"]:Clone()
	local RArmFX = Assets.RA.Emit:Clone()
	local RArm = Character["Right Arm"]
	RArmFX.Parent = RArm
	Humanoid.WalkSpeed = 0
	Humanoid.JumpPower = 0
	Humanoid.JumpHeight = 0
	FX.Parent = workspace.Effects
	FX.CFrame = RootPart.CFrame * CFrame.new(0,2,-5)
	anim1:Play()
	wait(.5)
	Humanoid.AutoRotate = false
	FX.Parent = workspace.Effects
	FX.CFrame = RootPart.CFrame * CFrame.new(0,-3,-25)
	FX.Sound:Play()
	local hitcontent = workspace:GetPartBoundsInBox(FX.CFrame, Vector3.new(18, 14.5, 52))
	local hitlist = {}
	for _,v in pairs(hitcontent) do
		if v.Parent:FindFirstChild("Humanoid") and v.Parent ~= Character then
			if not hitlist[v.Parent.Humanoid] then
				hitlist[v.Parent.Humanoid] = true
				local Tp = Assets["Root"]:Clone()
				for _,Particles in pairs(RArmFX.Parent:GetDescendants()) do
					if Particles:IsA("ParticleEmitter") then
						Particles:Emit(Particles:GetAttribute("EmitCount"))
					end
				end	
				local RootPart2 = v.Parent.HumanoidRootPart
				Tp.Parent = RootPart2
				Tp.Motor6D.Part1 = RootPart2
				p.Character:MoveTo(Tp.TP.Position)
				Tp:Destroy()
				local vel = Instance.new("BodyVelocity", v.Parent.HumanoidRootPart)
				vel.MaxForce = Vector3.new(1,1,1) * 1000000;
				vel.Parent = v.Parent.HumanoidRootPart
				vel.Velocity = Vector3.new(1,1,1) * p.Character:WaitForChild("HumanoidRootPart").CFrame.LookVector * 0
				vel.Name  =  "SmallMoveVel"
				game.Debris:AddItem(vel,0.1)
			end
		end
	end
	wait(.5)
	anim1:Stop()
	Humanoid.AutoRotate = true
	Humanoid.WalkSpeed = 16
	Humanoid.JumpPower = 50
	Humanoid.JumpHeight = 7.2
	wait(3)
	FX:Destroy()
end)
-- This function converts 4 different, redundant enumeration types to one standard so the values can be compared


function CameraUtils.ConvertCameraModeEnumToStandard(enumValue)
	if enumValue == Enum.TouchCameraMovementMode.Default then
		return Enum.ComputerCameraMovementMode.Follow
	end

	if enumValue == Enum.ComputerCameraMovementMode.Default then
		return Enum.ComputerCameraMovementMode.Classic
	end

	if enumValue == Enum.TouchCameraMovementMode.Classic or
		enumValue == Enum.DevTouchCameraMovementMode.Classic or
		enumValue == Enum.DevComputerCameraMovementMode.Classic or
		enumValue == Enum.ComputerCameraMovementMode.Classic then
		return Enum.ComputerCameraMovementMode.Classic
	end

	if enumValue == Enum.TouchCameraMovementMode.Follow or
		enumValue == Enum.DevTouchCameraMovementMode.Follow or
		enumValue == Enum.DevComputerCameraMovementMode.Follow or
		enumValue == Enum.ComputerCameraMovementMode.Follow then
		return Enum.ComputerCameraMovementMode.Follow
	end

	if enumValue == Enum.TouchCameraMovementMode.Orbital or
		enumValue == Enum.DevTouchCameraMovementMode.Orbital or
		enumValue == Enum.DevComputerCameraMovementMode.Orbital or
		enumValue == Enum.ComputerCameraMovementMode.Orbital then
		return Enum.ComputerCameraMovementMode.Orbital
	end

	if enumValue == Enum.ComputerCameraMovementMode.CameraToggle or
		enumValue == Enum.DevComputerCameraMovementMode.CameraToggle then
		return Enum.ComputerCameraMovementMode.CameraToggle
	end

	-- Note: Only the Dev versions of the Enums have UserChoice as an option
	if enumValue == Enum.DevTouchCameraMovementMode.UserChoice or
		enumValue == Enum.DevComputerCameraMovementMode.UserChoice then
		return Enum.DevComputerCameraMovementMode.UserChoice
	end

	-- For any unmapped options return Classic camera
	return Enum.ComputerCameraMovementMode.Classic
end

return CameraUtils
--[[
	Creates a debounced function that delays invoking fn until after secondsDelay seconds have elapsed since the last time the debounced function was invoked.
]]


function FunctionUtils.debounce(fn, secondsDelay)
	assert(FunctionUtils.isCallable(fn))
	assert(type(secondsDelay) == "number")

	local lastInvocation = 0
	local lastResult = nil

	return function(...)
		local args = {...}

		lastInvocation = lastInvocation + 1

		local thisInvocation = lastInvocation
		delay(
			secondsDelay,
			function()
				if thisInvocation ~= lastInvocation then
					return
				end

				lastResult = fn(unpack(args))
			end
		)

		return lastResult
	end
end
-----------------------------------


elseif script.Parent.Parent.Parent.TrafficControl.Value == "=" then

	for i = 1,#grp1 do
	grp1[i].Lighto.Enabled = true
	end	
	
		for i = 1,#grp1 do
	grp1[i].Transparency = 0
		end		
		
			for i = 1,#grp2 do
	grp2[i].Lighto.Enabled = false
	end	
	
		for i = 1,#grp2 do
	grp2[i].Transparency = 1
	end	

			for i = 1,#grp3 do
	grp3[i].Lighto.Enabled = false
	end	
	
		for i = 1,#grp3 do
	grp3[i].Transparency = 1
	end	

		for i = 1,#grp4 do
	grp4[i].Transparency = 1
		end	
		
					for i = 1,#grp4 do
	grp4[i].Lighto.Enabled = false
					end
----- cold tap handler -----



for i, v in pairs(coldTap:GetChildren()) do
	if v:FindFirstChild("ClickDetector") then
		v.ClickDetector.MouseClick:Connect(function()
			if coldOn.Value == false then
				coldOn.Value = true
				faucet.ParticleEmitter.Enabled = true
				waterSound:Play()
				coldTap:SetPrimaryPartCFrame(coldTap.PrimaryPart.CFrame * CFrame.Angles(math.rad(-45),0,0))
			else
				coldOn.Value = false
				if hotOn.Value == false then
					faucet.ParticleEmitter.Enabled = false
					waterSound:Stop()
				end
				coldTap:SetPrimaryPartCFrame(coldTap.PrimaryPart.CFrame * CFrame.Angles(math.rad(45),0,0))
			end
		end)
	end
end
-- Put this in StarterPlayer > StarterPlayerScripts



while true do
	local player = game.Players.LocalPlayer
	local sound = script.RainSound
	wait(math.random(10,20))

	local TweenService = game:GetService("TweenService")

	local part = game.Workspace. Terrain.Clouds

	local goal = {}
	goal.Density = 1
	--change this to how dense you want the clouds to be
	goal.Cover = 1
	--change this to how much the clouds cover the sky
	sound:Play()
	local tweenInfo = TweenInfo.new(5)
	--change the 5 to how long you want the transition to happen

	local tween = TweenService:Create(part, tweenInfo, goal)

	tween:Play()
	player.PlayerGui.Rain.Disabled = false
	wait(math.random(10,10))
	local TweenService = game:GetService("TweenService")

	local part = game.Workspace. Terrain.Clouds

	local goal = {}
	goal.Density = 1
	--change this to how dense you want the clouds to be
	goal.Cover = 0.5
	--change this to how much the clouds cover the sky
	sound:Stop()
	local tweenInfo = TweenInfo.new(5)
	--change the 5 to how long you want the transition to happen

	local tween = TweenService:Create(part, tweenInfo, goal)

	tween:Play()
	player.PlayerGui.Rain.Disabled = true
end
-- دالة السقوط


local function fall()
	local startPos = plank.Position
	local endPos = startPos - Vector3.new(0, fallHeight, 0)
	local startTime = tick()
	local elapsedTime = 0
	while elapsedTime <= fallingDuration do
		local t = elapsedTime / fallingDuration
		plank.Position = startPos:Lerp(endPos, t)
		wait()
		elapsedTime = tick() - startTime
	end
	plank.Position = originalPosition
end