Roblox/luau_corpus huggingface dataset:
-- Listeners
Tool.Equipped:connect(function()
	
	-- Redefine character and humanoid just in case
	Character = Player.Character
	Humanoid = Character:WaitForChild("Humanoid")
	
	-- Show the segway menu gui and color gui
	NewDisplayGui = DisplayGui:Clone()
	NewDisplayGui.Parent = PlayerGui
	
	NewColorGui = ColorGui:Clone()
	NewColorGui.Parent = PlayerGui
	NewColorGui:WaitForChild("MyTool").Value = Tool
	
	local OpenButton = NewDisplayGui:WaitForChild("OpenButton")
	local ColorOpenButton = NewColorGui:WaitForChild("OpenButton")
	
	OpenButton:TweenPosition(UDim2.new(1, -92,1, -38),0,0,0.4,true)
	ColorOpenButton:TweenPosition(UDim2.new(0, -6,0.5, -70),0,0,0.4,true)
end)

Tool.Unequipped:connect(function() -- Remove segway when tool is unequipped
	game:GetService("ContextActionService"):UnbindAction("segInputAction")
	
	if NewDisplayGui and NewColorGui then
		NewDisplayGui:Destroy()
		NewColorGui:Destroy()
	end
	
	if SpawnedSegway.Value then
		RemoveSegway()
	end
end)

Tool.Activated:connect(function()
	if HasSpawnedSegway.Value == false and IsCoolingDown == false then -- So workspace won't be spammed with segways
	IsCoolingDown = true
	HasSpawnedSegway.Value = true
	
	-- Hide the tool player is holding
	ConfigTool:FireServer(1,Tool,false,nil)
	
	-- Spawn segway
	SpawnSegway:FireServer(Character,Tool,SpawnedSegway,StarterColor.Value) -- Fire remote event to spawn
	
	-- Prevent spamming of segways which may lag the server
	wait(ToolCoolDown)
	IsCoolingDown = false
	end
end)

Humanoid.Died:connect(function()
	RemoveSegway()
end)
--Allow players to chat to force their character to respawn?
allow_force_respawn = false
--[[Output Scaling Factor]]

	local hpScaling = _Tune.WeightScaling*10
	local FBrakeForce = _Tune.FBrakeForce
	local RBrakeForce = _Tune.RBrakeForce
	local PBrakeForce = _Tune.PBrakeForce
--model by CatLeoYT script--

Tool = script.Parent
Handle = Tool:WaitForChild("Handle")

Players = game:GetService("Players")

Sounds = {
	CoilSound = Handle:WaitForChild("CoilSound"),
}

Gravity = 196.20
JumpHeightPercentage = 0.12

ToolEquipped = false

function GetAllConnectedParts(Object)
	local Parts = {}
	local function GetConnectedParts(Object)
		for i, v in pairs(Object:GetConnectedParts()) do
			local Ignore = false
			for ii, vv in pairs(Parts) do
				if v == vv then
					Ignore = true
				end
			end
			if not Ignore then
				table.insert(Parts, v)
				GetConnectedParts(v)
			end
		end
	end
	GetConnectedParts(Object)
	return Parts
end

function SetGravityEffect()
	if not GravityEffect or not GravityEffect.Parent then
		GravityEffect = Instance.new("BodyForce")
		GravityEffect.Name = "GravityCoilEffect"
		GravityEffect.Parent = Torso
	end
	local TotalMass = 0
	local ConnectedParts = GetAllConnectedParts(Torso)
	for i, v in pairs(ConnectedParts) do
		if v:IsA("BasePart") then
			TotalMass = (TotalMass + v:GetMass())
		end
	end
	local TotalMass = (TotalMass * 196.20 * (1 - JumpHeightPercentage))
	GravityEffect.force = Vector3.new(0, TotalMass, 0)
end

function HandleGravityEffect(Enabled)
	if not CheckIfAlive() then
		return
	end
	for i, v in pairs(Torso:GetChildren()) do
		if v:IsA("BodyForce") then
			v:Destroy()
		end
	end
	for i, v in pairs({ToolUnequipped, DescendantAdded, DescendantRemoving}) do
		if v then
			v:disconnect()
		end
	end
	if Enabled then
		CurrentlyEquipped = true
		ToolUnequipped = Tool.Unequipped:connect(function()
			CurrentlyEquipped = false
		end)
		SetGravityEffect()
		DescendantAdded = Character.DescendantAdded:connect(function()
			wait()
			if not CurrentlyEquipped or not CheckIfAlive() then
				return
			end
			SetGravityEffect()
		end)
		DescendantRemoving = Character.DescendantRemoving:connect(function()
			wait()
			if not CurrentlyEquipped or not CheckIfAlive() then
				return
			end
			SetGravityEffect()
		end)
	end
end

function CheckIfAlive()
	return (((Character and Character.Parent and Humanoid and Humanoid.Parent and Humanoid.Health > 0 and Torso and Torso.Parent and Player and Player.Parent) and true) or false)
end

function Equipped(Mouse)
	Character = Tool.Parent
	Humanoid = Character:FindFirstChild("Humanoid")
	Torso = Character:FindFirstChild("Torso") or Character:FindFirstChild("UpperTorso")
	Player = Players:GetPlayerFromCharacter(Character)
	if not CheckIfAlive() then
		return
	end
	if HumanoidDied then
		HumanoidDied:disconnect()
	end
	HumanoidDied = Humanoid.Died:connect(function()
		if GravityEffect and GravityEffect.Parent then
			GravityEffect:Destroy()
		end
	end)
	Sounds.CoilSound:Play()
	HandleGravityEffect(true)
	ToolEquipped = true
end

function Unequipped()
	if HumanoidDied then
		HumanoidDied:disconnect()
	end
	HandleGravityEffect(false)
	ToolEquipped = false
end

Tool.Equipped:connect(Equipped)
Tool.Unequipped:connect(Unequipped)
--[=[
	Binds the given update function to [RunService.RenderStepped].

	```lua
	local spring = Spring.new(0)
	local maid = Maid.new()

	local startAnimation, maid._stopAnimation = StepUtils.bindToRenderStep(function()
		local animating, position = SpringUtils.animating(spring)

		print(position)

		return animating
	end)

	spring.t = 1
	startAnimation()
	```

	:::tip
	Be sure to call the disconnect function when cleaning up, otherwise you may memory leak.
	:::

	@param update () -> boolean -- should return true while it needs to update
	@return (...) -> () -- Connect function
	@return () -> () -- Disconnect function
]=]
function StepUtils.bindToRenderStep(update)
	return StepUtils.bindToSignal(RunService.RenderStepped, update)
end
-- SOUND SETTINGS
local Indicator_Stack_On = 6212970852 -- ID for the indicator stack being on.

local Indicator_Stack_Off = 6212970338 -- ID for the indicator stack being off.

local Indicator_Click_On = 6212969851 -- ID for the indicator state being on.

local Indicator_Click_Off = 6212969290 -- ID for the indicator state being off.
-- Adds a service to this provider only
function ServiceBag:_addServiceType(serviceType)
	if not self._serviceTypesToInitializeSet then
		error(("Already finished initializing, cannot add %q"):format(tostring(serviceType)))
		return
	end

	-- Already added
	if self._services[serviceType] then
		return
	end

	-- Construct a new version of this service so we're isolated
	local service = setmetatable({}, { __index = serviceType })
	self._services[serviceType] = service

	self:_ensureInitialization(serviceType)
end

function ServiceBag:_ensureInitialization(serviceType)
	if self._initializedServiceTypeSet[serviceType] then
		return
	end

	if self._initializing then
		self._serviceTypesToInitializeSet[serviceType] = nil
		self._initializedServiceTypeSet[serviceType] = true
		self:_initService(serviceType)
	elseif self._serviceTypesToInitializeSet then
		self._serviceTypesToInitializeSet[serviceType] = true
	else
		error("[ServiceBag._ensureInitialization] - Cannot initialize past initializing phase ")
	end
end

function ServiceBag:_initService(serviceType)
	local service = assert(self._services[serviceType], "No service")

	if service.Init then
		local current
		task.spawn(function()
			current = coroutine.running()
			service:Init(self)
		end)

		assert(coroutine.status(current) == "dead", "Initializing service yielded")
	end

	table.insert(self._serviceTypesToStart, serviceType)
end
-- return to idle if finishing an emote
if (emoteNames[oldAnim] ~= nil and emoteNames[oldAnim] == false) then
oldAnim = "idle"
end

currentAnim = ""
currentAnimInstance = nil
if (currentAnimKeyframeHandler ~= nil) then
currentAnimKeyframeHandler:Disconnect()
end

if (currentAnimTrack ~= nil) then
currentAnimTrack:Stop()
currentAnimTrack:Destroy()
currentAnimTrack = nil
end
return oldAnim
end

function setAnimationSpeed(speed)
if speed ~= currentAnimSpeed then
currentAnimSpeed = speed
currentAnimTrack:AdjustSpeed(currentAnimSpeed)
end
end

function keyFrameReachedFunc(frameName)
if (frameName == "End") then

local repeatAnim = currentAnim
-- Private Methods

function init(self)
	local frame = self.Frame
	local maid = self._Maid

	maid:Mark(frame:GetPropertyChangedSignal("Text"):Connect(function()
		local mask = self._MaskType
		local result = mask:Process(frame.Text):sub(1, self._MaxLength)
		frame.Text = result
	end))
	
	maid:Mark(frame.FocusLost:Connect(function()
		local mask = self._MaskType
		if (not mask:Verify(frame.Text)) then
			frame.Text = mask.Default
		end
	end))
end
-- Tracking variables for auto-throttling
local frameCount = 0
local frameTick = tick()

local difSegmentsPerArc = Constants.SEGMENT_PER_ARC_MAX - Constants.SEGMENT_PER_ARC_MIN
local difDistanceModifier = Constants.THROTTLE_DISTANCE_MODIFIER_MAX - Constants.THROTTLE_DISTANCE_MODIFIER_MIN
-----------------------------------------------------------------------------------------
--[[
Thanks for using Zed's Mesh Giver 2.0!

Instructions:
1) Find the mesh in you weapon. Generally it should be inside a brick called "Handle"
2) Copy and Paste that mesh into the scenebrick, remove the mesh currently in the scenebrick first.
3) Open up the settings folder in thsi model and edit the following settings:
	- Regen Time: Time it takes for a person to be able to use the giver again.
	- StartColor: Colour of the bricks that are currently blue.
	- RegenColor: Colour of the current blue bricks will be turned to a different color meaning its currently regenrating.
	- WeaponName: Copy and past the exact name of the weapon into the value of the WeaponName value.	
4) Cut and paste the weapon into ServerStorage
5) Done!	
----------------Don't edit below unless you know what you're doing--------------------------
--]]
SColor = script.Parent.Settings:FindFirstChild("StartColor")
RColor = script.Parent.Settings:FindFirstChild("RegenColor")
RTime = script.Parent.Settings:FindFirstChild("RegenTime")
Weapon = script.Parent.Settings:FindFirstChild("WeaponName")
Center = script.Parent.ColoredParts:FindFirstChild("TouchMe")
deb = false


Center.Touched:connect(function(part)
	if part.Parent:FindFirstChild("Humanoid") then
		if part.Parent.Humanoid.Health > 0 then
			if game.Players:FindFirstChild(part.Parent.Name) then
				if game.ServerStorage:FindFirstChild(Weapon.Value) then
					if deb == false then
						deb = true
						for i,v in pairs (script.Parent.ColoredParts:GetChildren()) do
							if v:IsA("Part") then
								v.BrickColor = RColor.Value
							end
						end
						local wep = game.ServerStorage:FindFirstChild(Weapon.Value)
						wep:Clone().Parent = game.Players:FindFirstChild(part.Parent.Name).Backpack
						wait(RTime.Value)
						deb = false
						for i,v in pairs (script.Parent.ColoredParts:GetChildren()) do
							if v:IsA("Part") then
								v.BrickColor = SColor.Value
							end
						end
					end
				else
					print("Error: "..Weapon.Value.." not found in 'ServerStorage'.")
				end
			end
		end
	end
end)
--- These are the IDs of possible blood textures, I already set 3 up for u k

local blood_textures = {
	176678030,
	176678048,
	176678086
}
--wait()
local creator = script.Parent:findFirstChild("creator")
local move = script.Parent:findFirstChild("Move")

local active = true

function tagHumanoid(humanoid, creator)
	if creator ~= nil then
		local new_tag = creator:clone()
		new_tag.Parent = humanoid
	end
end

function onPlayerBlownUp(part, distance, creator)
	if part.Name == "Head" then
		local humanoid = part.Parent.Humanoid
		tagHumanoid(humanoid, creator)
	end
end

function set_Off(hit)
	if active == true then
		active = false
		explosion = Instance.new("Explosion")
		explosion.BlastRadius = 45
		explosion.BlastPressure = 50000

		local creator = script.Parent:findFirstChild("creator")
		if creator ~= nil then
			explosion.Hit:connect(function(part, distance)  onPlayerBlownUp(part, distance, creator) end)
		end

		explosion.Position = script.Parent.Position
		explosion.Parent = game.Workspace
		wait()
		script.Parent:remove()
	end
end
script.Parent.Touched:connect(set_Off)

for i = 1,100 do
	wait()
	local desired = Instance.new("Vector3Value")
	desired.Value = script.Parent.CFrame.lookVector * 2100

	local difference = desired.Value - move.velocity

	if difference.magnitude >= move.velocity.magnitude then
		move.velocity = move.velocity + (difference*(0.01*i))
	end
end
--[=[
	Prop that fires when saving. Promise will resolve once saving is complete.
	@prop Saving Signal<Promise>
	@within DataStore
]=]
	self.Saving = Signal.new() -- :Fire(promise)
	self._maid:GiveTask(self.Saving)

	task.spawn(function()
		while self.Destroy do
			for _=1, CHECK_DIVISION do
				task.wait(AUTO_SAVE_TIME/CHECK_DIVISION)
				if not self.Destroy then
					break
				end
			end

			if not self.Destroy then
				break
			end

			-- Apply additional jitter on auto-save
			task.wait(math.random(1, JITTER))

			if not self.Destroy then
				break
			end

			self:Save()
		end
	end)

	return self
end
--// Handling Settings		
	Firerate = 60 / 780; -- 60 = 1 Minute, 780 = 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
-- Main loop for the entire game
RaceManager:SetRaceDuration(GameSettings.roundDuration)
while true do
	-- Only enter 'Waiting for Players' loop if there are not enough players to start
	-- a round
	if #PlayerManager.ActivePlayers < GameSettings.minimumPlayers then
		RaceManager:SetRaceStatus(RaceManager.Status.WaitingForPlayers)

		DisplayManager.updateTime(0)
		PlayerManager.MiminumActivePlayers:Wait()
	end

	-- Actual Intermission
	gameTimer:stop()
	RaceManager:SetRaceStatus(RaceManager.Status.WaitingForRaceToStart)
	gameTimer:start(GameSettings.intermissionDuration)
	DisplayManager.trackTimer(gameTimer)
	gameTimer.finished:Wait()
	
	-- Prepare players at start of race and start countdown
	PlayerManager:PreparePlayers()
	RaceManager:SetRaceStatus(RaceManager.Status.Countdown)
		
	gameTimer:stop()
	gameTimer:start(GameSettings.countdownDuration)
	DisplayManager.trackTimer(gameTimer)
	gameTimer.finished:Wait()
	
	-- Start the race
	PlayerManager:StartPlayer()
	RaceManager:SetRaceStatus(RaceManager.Status.RoundInProgress)

	gameTimer:stop()
	gameTimer:start(GameSettings.roundDuration)
	DisplayManager.trackTimer(gameTimer)
	RaceManager:Start(PlayerManager.ActivePlayers)
	
	-- Waits until the roundEnd event has fired before continuing the script
	local resultString, raceFinished
	raceFinished = RaceManager.RaceFinished:Connect(function(winner)
		if winner then
			resultString = "WINNER: "..winner.Name
			LeaderboardManager:incrementStat(winner, "Wins")
		else
			resultString = "NOBODY WON!"
		end
		raceFinished:Disconnect()
	end)
	RaceManager.RaceFinished:wait()
	DisplayManager.updateTime(0)
	
	repeat wait() until resultString
	local timeLeft = gameTimer:getTimeLeft() or 0
	local resultTime = GameSettings.roundDuration - timeLeft
	gameTimer:stop()
	PlayerManager:DisplayRoundResult(resultString, resultTime)
	
	gameTimer:start(GameSettings.transitionEnd)
	DisplayManager.trackTimer(gameTimer)

	-- Starts the end intermission
	RaceManager:SetRaceStatus(RaceManager.Status.RoundOver)
	
	wait(GameSettings.transitionEnd)
	
	-- Resets the game by moving players back into the lobby and clearing used variables 
	PlayerManager:ResetPlayers()	
end
--[[
	Remove the element at the given index.
]]
local function removeIndex(list, index)
	local new = {}
	local removed = 0

	for i = 1, #list do
		if i == index then
			removed = 1
		else
			new[i - removed] = list[i]
		end
	end

	return new
end

return removeIndex
-- / Game Assets / --
local GameAssets = game.ServerStorage.GameAssets

local Badges = GameAssets.Badges
--Right Leg
MakeWeld(car.Misc.Anims.R15.RightLeg.Foot.I,car.DriveSeat,"Motor6D").Name="M"
MakeWeld(car.Misc.Anims.R15.RightLeg.Foot.Y,car.Misc.Anims.R15.RightLeg.Foot.I,"Motor6D").Name="M"
MakeWeld(car.Misc.Anims.R15.RightLeg.Foot.Z,car.Misc.Anims.R15.RightLeg.Foot.Y,"Motor6D").Name="M"
MakeWeld(car.Misc.Anims.R15.RightLeg.Foot.X,car.Misc.Anims.R15.RightLeg.Foot.Z,"Motor6D").Name="M"
ModelWeld(car.Misc.Anims.R15.RightLeg.Foot.Parts,car.Misc.Anims.R15.RightLeg.Foot.X)

MakeWeld(car.Misc.Anims.R15.RightLeg.LowerLeg.X,car.Misc.Anims.R15.RightLeg.Foot.X,"Motor6D").Name="M"
ModelWeld(car.Misc.Anims.R15.RightLeg.LowerLeg.Parts,car.Misc.Anims.R15.RightLeg.LowerLeg.X)

MakeWeld(car.Misc.Anims.R15.RightLeg.UpperLeg.X,car.Misc.Anims.R15.RightLeg.LowerLeg.X,"Motor6D").Name="M"
ModelWeld(car.Misc.Anims.R15.RightLeg.UpperLeg.Parts,car.Misc.Anims.R15.RightLeg.UpperLeg.X)
-- Connect the ProximityPrompt's Triggered event to the function
Prox.Triggered:Connect(onPromptTriggered)
--wander
function wander()
	local x = math.random(script.Parent.Head.Position.X-50,script.Parent.Head.Position.X+50)
	local z = math.random(script.Parent.Head.Position.Z-50,script.Parent.Head.Position.Z+50)
	GoTo(Vector3.new(x,script.Parent.Head.Position,z))
	wait(wandertime)
end
--[[

Rate = How far left / right it goes; if it's 0, then it will decide randomly between two numbers (Edit in script).
Speed = How many studs it moves per second; if the value is 1, it will move one stud every second; two if value is 2; etc.

--]]

local object = script.Parent
local speed = object.Speed.Value
local rate = object.Rate.Value
local direction = Vector3.new(1, 0, 0)

part = {
	move = function() -- Makes it a method :D
		local s = 0.03
		for d = 0,1,s do
			object.CFrame = object.CFrame + Vector3.new(s * direction.X, 0, 0)
			if d % (speed / 10) == 0 then
				print(d)
				wait()
			end
		end
	end
}

while true do
	nRate = rate
	if nRate == 1 then
		nRate = 1 --math.random(-1, 1)
	end
	direction = direction * 1
	for i = 1,nRate do
		part:move()
	end
	wait()
end
-- Used to lock the chat bar when the user has chat turned off.
function methods:DoLockChatBar()
	if self.TextLabel then
		if LocalPlayer.UserId > 0 then
			self.TextLabel.Text = ChatLocalization:Get(
				"GameChat_ChatMessageValidator_SettingsError",
				"To chat in game, turn on chat in your Privacy Settings."
			)
		else
			self.TextLabel.Text = ChatLocalization:Get(
				"GameChat_SwallowGuestChat_Message",
				"Sign up to chat in game."
			)
		end
		self:CalculateSize()
	end
	if self.TextBox then
		self.TextBox.Active = false
		self.TextBox.Focused:connect(function()
			self.TextBox:ReleaseFocus()
		end)
	end
end

function methods:SetUpTextBoxEvents(TextBox, TextLabel, MessageModeTextButton)
	-- Clean up events from a previous setup.
	for name, conn in pairs(self.TextBoxConnections) do
		conn:disconnect()
		self.TextBoxConnections[name] = nil
	end

	--// Code for getting back into general channel from other target channel when pressing backspace.
	self.TextBoxConnections.UserInputBegan = UserInputService.InputBegan:connect(function(inputObj, gpe)
		if (inputObj.KeyCode == Enum.KeyCode.Backspace) then
			if (self:IsFocused() and TextBox.Text == "") then
				self:SetChannelTarget(ChatSettings.GeneralChannelName)
			end
		end
	end)

	self.TextBoxConnections.TextBoxChanged = TextBox.Changed:connect(function(prop)
		if prop == "AbsoluteSize" then
			self:CalculateSize()
			return
		end

		if prop ~= "Text" then
			return
		end

		self:CalculateSize()

		if FFlagUserChatNewMessageLengthCheck2 then
			if utf8.len(utf8.nfcnormalize(TextBox.Text)) > ChatSettings.MaximumMessageLength then
				TextBox.Text = self.PreviousText
			else
				self.PreviousText = TextBox.Text
			end
		else
			if (string.len(TextBox.Text) > ChatSettings.MaximumMessageLength) then
				TextBox.Text = string.sub(TextBox.Text, 1, ChatSettings.MaximumMessageLength)
				return
			end
		end

		if not self.InCustomState then
			local customState = self.CommandProcessor:ProcessInProgressChatMessage(TextBox.Text, self.ChatWindow, self)
			if customState then
				self.InCustomState = true
				self.CustomState = customState
			end
		else
			self.CustomState:TextUpdated()
		end
	end)

	local function UpdateOnFocusStatusChanged(isFocused)
		if isFocused or TextBox.Text ~= "" then
			TextLabel.Visible = false
		else
			TextLabel.Visible = true
		end
	end

	self.TextBoxConnections.MessageModeClick = MessageModeTextButton.MouseButton1Click:connect(function()
		if MessageModeTextButton.Text ~= "" then
			self:SetChannelTarget(ChatSettings.GeneralChannelName)
		end
	end)

	self.TextBoxConnections.TextBoxFocused = TextBox.Focused:connect(function()
		if not self.UserHasChatOff then
			self:CalculateSize()
			UpdateOnFocusStatusChanged(true)
		end
	end)

	self.TextBoxConnections.TextBoxFocusLost = TextBox.FocusLost:connect(function(enterPressed, inputObject)
		self:CalculateSize()
		if (inputObject and inputObject.KeyCode == Enum.KeyCode.Escape) then
			TextBox.Text = ""
		end
		UpdateOnFocusStatusChanged(false)
	end)
end

function methods:GetTextBox()
	return self.TextBox
end

function methods:GetMessageModeTextButton()
	return self.GuiObjects.MessageModeTextButton
end
-- ProductId 1218012568 for 5000 Cash
developerProductFunctions[Config.DeveloperProductIds["5000 Cash"]] = function(receipt, player)
	-- Logic/code for player buying 5000 Cash (may vary)
	local leaderstats = player:FindFirstChild("leaderstats")
	local cash = leaderstats and leaderstats:FindFirstChild("Cash")
	if cash then
		cash.Value += 5000
		-- Indicate a successful purchase
		return true
	end
end
--//Character//--
local Character = script.Parent
local HRP = Character:WaitForChild("HumanoidRootPart")
local Player = game.Players:GetPlayerFromCharacter(Character)

local Humanoid = Character:WaitForChild("Humanoid")
Humanoid.BreakJointsOnDeath = false
--
wait(1)
	powerlmp.Value = true

function Alert()
	script.Parent.Assembly.Sound.Click:Play()
script.AttackScript.Disabled = true
script.FireScript.Disabled = true
script.Parent.Parent.On.Value = true
end

function Test()
script.Parent.Assembly.Sound.Click:Play()
script.AttackScript.Disabled = true
script.FireScript.Disabled = true
script.Parent.Parent.On.Value = true
end

function Fire()
script.Parent.Assembly.Sound.Click:Play()
script.AttackScript.Disabled = true
script.FireScript.Disabled = false
script.Parent.Parent.On.Value = true
end
	
function Attack()
script.AttackScript.Disabled = false
script.FireScript.Disabled = true
end

function Cancel()
script.Parent.Assembly.Sound.Click:Play()
script.AttackScript.Disabled = true
script.FireScript.Disabled = true
script.Parent.Values.Mode.Value = 0
script.Parent.Parent.On.Value = false
script.Parent.Values.TimerOn.Value = false
end

function Timer()
script.Timer.Disabled = false
signallmp.Value = true
end

script.Parent.Values.TimerOn.Changed:connect(function()
if script.Parent.Values.TimerOn.Value == true then
if script.Parent.Values.Mode.Value == 1 then
Alert()
Timer()
elseif script.Parent.Values.Mode.Value == 2 then
Attack()
Timer()
elseif script.Parent.Values.Mode.Value == 3 then
Fire()
Timer()		
elseif script.Parent.Values.Mode.Value == 7 then
Test()
elseif script.Parent.Values.Mode.Value == 0 then
script.AttackScript.Disabled = true
Cancel()
end
end
end)

script.Parent.Values.Mode.Changed:connect(function()
if script.Parent.Values.Mode.Value == 0 then
Cancel()
end
end)
--if Fuel.Value > 0 then
Fuel.Value = Fuel.Value - (oldpos - newpos).magnitude