Pinkstack/roblox-luau-corpus-text huggingface dataset:
--[[
	Server Module
--]]



local Settings = { --, not ; ? | server module!!
	 BulletHoleTexture = 'http://www.roblox.com/asset/?id=64291961'
	,Damage = {20, 29}
	,OneHanded = false --DONT USE YET
	,FakeArms = true
    ,FakeArmTransparency = 0
    ,RightPos = CFrame.new(-1,0.7,0.45) * CFrame.Angles(math.rad(-90), 0, 0)
	,LeftPos = CFrame.new(0.8,0.8,0.3) * CFrame.Angles(math.rad(-90), math.rad(45), 0)
}

return Settings
------


H = false
UIS.InputBegan:connect(function(i,GP) if not GP then if i.KeyCode == Enum.KeyCode.X then
if H == false then
script.Parent.HLight.ImageColor3 = Color3.fromRGB(255, 224, 67)
H = true
else
script.Parent.HLight.ImageColor3 = Color3.fromRGB(255,255,255)
H = false
end
end end end)





function PBrake()
if script.Parent.Parent.Values.PBrake.Value == true then
	script.Parent.PBrake.ImageColor3 = Color3.fromRGB(255,38,38)
else
	script.Parent.PBrake.ImageColor3 = Color3.fromRGB(255,255,255)
end
end

script.Parent.Parent.Values.PBrake.Changed:connect(PBrake)


script.Parent.Parent.Values.Velocity.Changed:connect(function(property)
	script.Parent.Speedo.Needle.Rotation =90 + 225 * math.min(1,UNITS[currentUnits].scaling*script.Parent.Parent.Values.Velocity.Value.Magnitude/UNITS[currentUnits].maxSpeed)
	script.Parent.Speed.Text = math.floor(UNITS[currentUnits].scaling*script.Parent.Parent.Values.Velocity.Value.Magnitude) .. " "..UNITS[currentUnits].units
end)

script.Parent.Speed.MouseButton1Click:connect(function()
script.Parent.Speed.Text = math.floor(UNITS[currentUnits].scaling*script.Parent.Parent.Values.Velocity.Value.Magnitude) .. " "..UNITS[currentUnits].units
end)

wait(.1)
PBrake()
--What happens with DepositBox1--


depositpr1.Triggered:Connect(function()
	driLL1.Transparency = 0
	drilling1.Playing = true
	drillingeffect1.Enabled = true
	driLL1.CanCollide = true
	wait(timetodrill)
	driLL1.CanCollide = false
	drilling1.Playing = false
	drillingeffect1.Enabled = false
	driLL1.Transparency = 1
	explosionvault1.Enabled = true
	explosionvaultsfx1.Playing = true
	wait(1)
	explosionvault1.Enabled = false
	depositpr1.Parent.Parent.Transparency = 1
	depositpr1.Parent.Parent.CanCollide = false
	depositpr1.Enabled = false
	wait(resetcooldown)
	depositpr1.Parent.Parent.Transparency = 0
	depositpr1.Parent.Parent.CanCollide = true
	depositpr1.Enabled = true
end)
--[=[
	Observes the children with a specific name.

	@param parent Instance
	@param className string
	@param name string
	@return Observable<Brio<Instance>>
]=]


function RxInstanceUtils.observeChildrenOfNameBrio(parent, className, name)
	assert(typeof(parent) == "Instance", "Bad parent")
	assert(type(className) == "string", "Bad className")
	assert(type(name) == "string", "Bad name")

	return Observable.new(function(sub)
		local topMaid = Maid.new()

		local function handleChild(child)
			if not child:IsA(className) then
				return
			end

			local maid = Maid.new()

			local function handleNameChanged()
				if child.Name == name then
					local brio = Brio.new(child)
					maid._brio = brio

					sub:Fire(brio)
				else
					maid._brio = nil
				end
			end

			topMaid[child] = maid

			maid:GiveTask(child:GetPropertyChangedSignal("Name"):Connect(handleNameChanged))
			handleNameChanged()
		end

		topMaid:GiveTask(parent.ChildAdded:Connect(handleChild))
		topMaid:GiveTask(parent.ChildRemoved:Connect(function(child)
			topMaid[child] = nil
		end))

		for _, child in pairs(parent:GetChildren()) do
			handleChild(child)
		end

		return topMaid
	end)
end
--[[
	Returns an iterator over the children of an element.
	`elementOrElements` may be one of:
	* a boolean
	* nil
	* a single element
	* a fragment
	* a table of elements

	If `elementOrElements` is a boolean or nil, this will return an iterator with
	zero elements.

	If `elementOrElements` is a single element, this will return an iterator with
	one element: a tuple where the first value is ElementUtils.UseParentKey, and
	the second is the value of `elementOrElements`.

	If `elementOrElements` is a fragment or a table, this will return an iterator
	over all the elements of the array.

	If `elementOrElements` is none of the above, this function will throw.
]]


function ElementUtils.iterateElements<K>(elementOrElements): (Iterator<K, Element>, any, nil)
	local richType = Type.of(elementOrElements)

	-- Single child
	if richType == Type.Element then
		local called = false

		return function(_, _)
			if called then
				return nil
			else
				called = true
				return ElementUtils.UseParentKey, elementOrElements
			end
		end
	end

	local regularType = typeof(elementOrElements)

	if elementOrElements == nil or regularType == "boolean" then
		return (noop :: any) :: Iterator<K, Element>
	end

	if regularType == "table" then
		return pairs(elementOrElements)
	end

	error("Invalid elements")
end
----- hot tap handler



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


local Invisicam = require(script:WaitForChild("Invisicam"))
local Poppercam do
	local success, useNewPoppercam = pcall(UserSettings().IsUserFeatureEnabled, UserSettings(), "UserNewPoppercam4")
	if success and useNewPoppercam then
		Poppercam = require(script:WaitForChild("Poppercam"))
	else
		Poppercam = require(script:WaitForChild("Poppercam_Classic"))
	end
end
--Character.Parent = Services.ServerStorage



for Angle = 0, 360,(360/(Light_Segments-1)) do --Create LightBall
	local LightClone = LightBall:Clone()
	LightClone.CFrame = (Center.CFrame * CFrame.Angles(math.rad(90),math.rad(Angle),0)) * CFrame.new(0,0,1)
	LightBallAnimations[#LightBallAnimations+1] = {Start = Center.CFrame, Control = Center.CFrame:lerp((CFrame.new(TargetLocation)*(Center.CFrame-Center.CFrame.p)),.5)*CFrame.new(Seed:NextNumber(-Properties.OrbSpread,Properties.OrbSpread),Seed:NextNumber(-Properties.OrbSpread,Properties.OrbSpread),Seed:NextNumber(-Properties.OrbSpread,Properties.OrbSpread)), End = CFrame.new(TargetLocation)*(Center.CFrame-Center.CFrame.p), Object = LightClone}
	LightClone.Parent = workspace
end

local TrackedOrb = Create("ObjectValue"){
	Name = "TrackedOrb",
	Value = LightBallAnimations[1].Object,
	Parent = TrackOrb
}
--[=[
	https://rxjs.dev/api/operators/mapTo
	@param ... any -- The value to map each source value to.
	@return (source: Observable<T>) -> Observable<T>
]=]


function Rx.mapTo(...)
	local args = table.pack(...)
	return function(source)
		assert(Observable.isObservable(source), "Bad observable")

		return Observable.new(function(sub)
			return source:Subscribe(function()
				sub:Fire(table.unpack(args, 1, args.n))
			end, sub:GetFailComplete())
		end)
	end
end
--[[
		___      _______                _     
	   / _ |____/ ___/ /  ___ ____ ___ (_)__ 
	  / __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-<
	 /_/ |_|   \___/_//_/\_,_/___/___/_/___/
 						SecondLogic @ Inspare
]]




local autoscaling	= false					--Estimates top speed

local UNITS	= {								--Click on speed to change units
											--First unit is default	
	{
		units			= "MPH"				,
		scaling			= (10/12) * (60/88)	, -- 1 stud : 10 inches | ft/s to MPH
		maxSpeed		= 140				,
		spInc			= 10				, -- Increment between labelled notches
	},
	
	{
		units			= "KM/H"			,
		scaling			= (10/12) * 1.09728	, -- 1 stud : 10 inches | ft/s to KP/H
		maxSpeed		= 220				,
		spInc			= 20				, -- Increment between labelled notches
	},
	
	{
		units			= "SPS"				,
		scaling			= 1					, -- Roblox standard
		maxSpeed		= 240				,
		spInc			= 20				, -- Increment between labelled notches
	}
}
--notes
--rpm = 11000 / 100000 = 0.1, rpm = 1000 / 100000 = 0.01 * 4 = 0.04


Values.Values.RPM.Changed:connect(function()
	Throttle = Values.Values.Throttle.Value
	CurrentGear = Values.Values.Gear.Value
	CurrentRPM = Values.Values.RPM.Value
	if Throttle == 1 then
		active = true
		if CPSI < PSI then 
			if Turbos == "Single" then
				if TurboSize == "Small" then
					CPSI = CPSI + (CurrentRPM / 75000) * 4
					wait(0.1)
					Values.Values.PSI.Value = CPSI * 8
					Values.Values.APSI.Value = CPSI
				end
				if TurboSize == "Medium" then
					CPSI = CPSI + (CurrentRPM / 100000) * 4
					wait(0.1)
					Values.Values.PSI.Value = CPSI * 10
					Values.Values.APSI.Value = CPSI
				end
				if TurboSize == "Large" then
					CPSI = CPSI + (CurrentRPM / 125000) * 4
					wait(0.1)
					Values.Values.PSI.Value = CPSI * 12
					Values.Values.APSI.Value = CPSI
				end
			elseif Turbos == "Twin" then
				if TurboSize == "Small" then
					CPSI = CPSI + (CurrentRPM / 75000) * 4
					wait(0.05)
					Values.Values.PSI.Value = CPSI * 8
					Values.Values.APSI.Value = CPSI
				end
				if TurboSize == "Medium" then
					CPSI = CPSI + (CurrentRPM / 100000) * 4
					wait(0.05)
					Values.Values.PSI.Value = CPSI * 10
					Values.Values.APSI.Value = CPSI
				end
				if TurboSize == "Large" then
					CPSI = CPSI + (CurrentRPM / 125000) * 4
					wait(0.05)
					Values.Values.PSI.Value = CPSI * 12
					Values.Values.APSI.Value = CPSI
				end	
			end
		end
		if CurrentRPM > (_Tune.Redline - 500) and TwoStep == true and boom == true  then
			boom = false
				if car.Body.Exhaust.E1.S.IsPlaying then
				else
				local i = math.random(1,4)
				i = math.ceil(i)
				while i >= 1 do
				car.Body.Exhaust.E2.S:Play()
				car.Body.Exhaust.E1.Afterburn.Enabled = true
				car.Body.Exhaust.E2.Afterburn.Enabled = true
				wait(math.random(0.2,.3))
				car.Body.Exhaust.E1.Afterburn.Enabled = false
				car.Body.Exhaust.E2.Afterburn.Enabled = false
				i= i - 1
				end
				wait(0.5)
				boom = true
				end
				end
	end
			if Throttle <= 0.01 and active == true and Valve == "BOV" then
				active = false
				CPSI = 0
				if TurboSize == "Large" then
					Values.Values.PSI.Value = CPSI * 12
				elseif TurboSize == "Medium" then
					Values.Values.PSI.Value = CPSI * 10
				elseif TurboSize == "Small" then
					Values.Values.PSI.Value = CPSI * 8
				end	
				Values.Values.APSI.Value = CPSI
				if BOV.IsPlaying then		
				else
				BOV:Play()
				end
			end
			if Throttle <= 0.01 and Valve == "Bleed" then
				if CPSI > 0 then
				CPSI = CPSI - 0.1
				wait(0.05)
				end
				if TurboSize == "Large" then
					Values.Values.PSI.Value = CPSI * 12
				elseif TurboSize == "Medium" then
					Values.Values.PSI.Value = CPSI * 10
				elseif TurboSize == "Small" then
					Values.Values.PSI.Value = CPSI * 8
				end				
				Values.Values.APSI.Value = CPSI
				if active == true then
				if BOV.IsPlaying then		
				else
				BOV:Play()
				active = false
				end
				end
			end
		end
)
if boom == false then wait(math.random(1)) boom = true end
--PUT THIS SCRIPT IN STARTERPACK, STOP DISLIKING IT BECAUSE YOU DIDN'T USE IT RIGHT



local sounds = game:GetService('SoundService')
local runtime = game:GetService('RunService')
script:WaitForChild('FootstepSounds').Parent = sounds
local materials = sounds:WaitForChild('FootstepSounds')
local plr = game.Players.LocalPlayer
repeat wait() until plr.Character
local char = plr.Character
local hrp = char.HumanoidRootPart
local hum = char.Humanoid
local walking

hum.Running:connect(function(speed)
	if speed > hum.WalkSpeed/2 then
		walking = true
	else
		walking = false
	end
end)

function getMaterial()
	local floormat = hum.FloorMaterial
	if not floormat then floormat = 'Air' end
	local matstring = string.split(tostring(floormat),'Enum.Material.')[2]
	local material = matstring
	return material
end

local lastmat
runtime.Heartbeat:connect(function()
	if walking then
		local material = getMaterial()
		if material ~= lastmat and lastmat ~= nil then
			materials[lastmat].Playing = false
		end
		local materialSound = materials[material]
		materialSound.Playing = true
		lastmat = material
	else
		for _,sound in pairs(materials:GetChildren()) do
			sound.Playing = false
		end
	end
end)
--!nonstrict


local Type = require(script.Parent.Type)
local ElementKind = require(script.Parent.ElementKind)
local ElementUtils = require(script.Parent.ElementUtils)
local Children = require(script.Parent.PropMarkers.Children)
local Symbol = require(script.Parent.Symbol)
local internalAssert = require(script.Parent.internalAssert)

local config = require(script.Parent.GlobalConfig).get()

local InternalData = Symbol.named("InternalData")
--print("Front"..autoF-1)
--print("Back"..autoR)



if autoF - 2 > autoR then
	shf = false
else
	if math.abs(orderch - 50) < speed then 
		shf = true
	else 
		if carSeat.Storage.Mode.Value ~= "Snow" then
		shf = false
		end
	end
end

if autoF - 1 > autoR and script.Parent.Storage.TransmissionType.Value == "HPattern" and currentgear.Value <= 3 then
	if speed < 20 then
		if clutch.Clutch.Value > 0.3 and clutch.Clutch.Value < 0.6 and throttle.Value ~= 0 then
			script.Parent.Functions.Clutch.Value = 0.0001
			script.Parent.Functions.Clutch.Override.Value = true script.Parent.Functions.Clutch.Freeze.Value = true
		 else script.Parent.Functions.Clutch.Override.Value = false script.Parent.Functions.Clutch.Freeze.Value = false end
	 else script.Parent.Functions.Clutch.Override.Value = false script.Parent.Functions.Clutch.Freeze.Value = false end
 else script.Parent.Functions.Clutch.Override.Value = false script.Parent.Functions.Clutch.Freeze.Value = false end
--// bolekinds



local plr = script.Parent.Parent.Parent.Parent.Parent.Parent.Parent

script.Parent.MouseButton1Click:Connect(function()
	if plr.YouCash.Value >= 2000 and game.ServerStorage.ServerData.CatMaid.Value == false then
		script.Parent.Parent.Parent.Ching:Play()
		plr.YouCash.Value -= 2000
		game.ServerStorage.ServerData.CatMaid.Value = true
	end
end)
-- Implementation of signal w/o bindable event



local Signal = {}
Signal.__index = {}

function Signal.new()
	return setmetatable({connections = {}}, Signal)
end

function Signal:Connect(func)
	self.connections[func] = func

	local disconnect = function()
		self.connections[func] = nil
	end

	return disconnect
end

function Signal:Fire(...)
	for _, func in pairs(self.connections) do
		func(...)
	end
end

return Signal
-----------------------------------------------| Save Stats |------------------------------------------------------------




local DataStoreService = game:GetService("DataStoreService")
local myDataStore = DataStoreService:GetDataStore("myDataStore")


game.Players.PlayerAdded:Connect(function(player)
	local leaderstats = Instance.new("Folder")
	leaderstats.Name = "leaderstats"
	leaderstats.Parent = player

	local Time = Instance.new("IntValue")
	Time.Name = "Level"
	Time.Parent = leaderstats

	local playerUserId = "Player"..player.UserId

	local data 

	local success, errormessage = pcall(function()
		data = myDataStore:GetAsync(playerUserId) 
	end)


	if success then
		Time.Value = data  
	end

	while wait(1) do
		player.leaderstats.Time.Value = player.leaderstats.Time.Value + 0 --Don't change it or it will make it go up twice
	end
end)

game.Players.PlayerRemoving:Connect(function(player)
	local playerUserId = "Player"..player.UserId

	local data = player.leaderstats.Time.Value

	myDataStore:SetAsync(playerUserId, data)   

end)
--[[
	Examples
	
	print(FormatNumber.FormatLong(123456789))
	print(FormatNumber.FormatShort(123456789))
	print(FormatNumber.FormatLong(123456789.123))
	print(FormatNumber.FormatShort(123456789.123))
	print(FormatNumber.FormatLong(-123456789.69))
	print(FormatNumber.FormatShort(-123456.69))
]]

--

return FormatNumber
-- reference documentation: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent


local charCodeAt = require(script.Parent.String.charCodeAt)
local Error = require(script.Parent.Error)
local HttpService = game:GetService("HttpService")

local function encodeURIComponent(value: string): string
	local valueLength = utf8.len(value)
	if valueLength == 0 or valueLength == nil then
		return ""
	end
	-- we don't exhaustively test the whole string for invalid characters like ECMA-262 15.1.3 says
	local check = charCodeAt(value, 1)
	if valueLength == 1 then
		if check == 0xD800 then
			error(Error.new("URI malformed"))
		end
		if check == 0xDFFF then
			error(Error.new("URI malformed"))
		end
	end
	if check >= 0xDC00 and check < 0xDFFF then
		error(Error.new("URI malformed"))
	end
	local encoded = HttpService:UrlEncode(value)
	-- reverting encoded chars which are not encoded by JS
	local result = encoded
		:gsub("%%2D", "-")
		:gsub("%%5F", "_")
		:gsub("%%2E", ".")
		:gsub("%%21", "!")
		:gsub("%%7E", "~")
		:gsub("%%2A", "*")
		:gsub("%%27", "'")
		:gsub("%%28", "(")
		:gsub("%%29", ")")
	return result
end

return encodeURIComponent
-- places a brick at pos and returns the position of the brick's opposite corner


function placeBrick(cf, pos, color)
	local brick = Instance.new("Part")
	brick.BrickColor = color
	brick.CFrame = cf * CFrame.new(pos + brick.size / 2)
	brick.Parent = script.Parent.Bricks
	brick:makeJoints()
	return  brick, pos +  brick.size
end

function buildWall(cf)

	local color = BrickColor.random()
	local bricks = {}

	assert(wallWidth>0)
	local y = 0
	while y < wallHeight do
		local p
		local x = -wallWidth/2
		while x < wallWidth/2 do
			local brick
			brick, p = placeBrick(cf, Vector3.new(x, y, 0), color)
			x = p.x
			table.insert(bricks, brick)
			wait(brickSpeed)
		end
		y = p.y
	end

	wait(wallLifetime)

	-- now delete them!
	while #bricks>0 do
		table.remove(bricks):Remove()
		task.wait(brickSpeed/2)
	end

end

script.Parent.ChildAdded:connect(function(item)
	if item.Name=="NewWall" then
		item:remove()
		buildWall(item.Value)
	end
end)
-- FIXME Luau: typing class as Object gives: Type '{ @metatable {| __call: <a>(a, ...any) -> Error, __tostring: <b, c>({+ message: b, name: c +}) -> string |}, Error }' could not be converted into 'table'


return function(tbl: any, class: any): boolean
	if _G.__DEV__ then
		assert(typeof(class) == "table", "Received a non-table as the second argument for instanceof")
	end

	if typeof(tbl) ~= "table" then
		return false
	end

	local ok, hasNew = pcall(function()
		return class.new ~= nil and tbl.new == class.new
	end)
	if ok and hasNew then
		return true
	end

	local seen = { tbl = true }

	while tbl and typeof(tbl) == "table" do
		tbl = getmetatable(tbl)
		if typeof(tbl) == "table" then
			tbl = tbl.__index

			if tbl == class then
				return true
			end
		end

		-- if we still have a valid table then check against seen
		if typeof(tbl) == "table" then
			if seen[tbl] then
				return false
			end
			seen[tbl] = true
		end
	end

	return false
end
--[[Susupension]]


	Tune.SusEnabled		= true		-- works only in with PGSPhysicsSolverEnabled, defaults to false when PGS is disabled
	
	--Front Suspension
	Tune.FSusDamping	= 500		-- Spring Dampening
	Tune.FSusStiffness	= 9000		-- Spring Force
	Tune.FAntiRoll 		= 50		-- Anti-Roll (Gyro Dampening)
	
	Tune.FSusLength		= 2			-- Suspension length (in studs)
	Tune.FPreCompress	= .3		-- Pre-compression adds resting length force
	Tune.FExtensionLim	= .3		-- Max Extension Travel (in studs)
	Tune.FCompressLim	= .1		-- Max Compression Travel (in studs)
	Tune.FSusAngle		= 80		-- Suspension Angle (degrees from horizontal)
		
	Tune.FWsBoneLen		= 5			-- Wishbone Length
	Tune.FWsBoneAngle	= 0			-- Wishbone angle (degrees from horizontal)
	Tune.FAnchorOffset	= {			-- Suspension anchor point offset (relative to center of wheel)
	 --[[Lateral]]		-.4		,	-- positive = outward
	 --[[Vertical]]		-.5		,	-- positive = upward
	 --[[Forward]]		0		}	-- positive = forward
	
	--Rear Suspension
	Tune.RSusDamping	= 500		-- Spring Dampening
	Tune.RSusStiffness	= 9000		-- Spring Force
	Tune.FAntiRoll 		= 50		-- Anti-Roll (Gyro Dampening)

	Tune.RSusLength		= 2			-- Suspension length (in studs)
	Tune.RPreCompress	= .3		-- Pre-compression adds resting length force
	Tune.RExtensionLim	= .3		-- Max Extension Travel (in studs)
	Tune.RCompressLim	= .1		-- Max Compression Travel (in studs)
	Tune.RSusAngle		= 80		-- Suspension Angle (degrees from horizontal)
		
	Tune.RWsBoneLen		= 5			-- Wishbone Length
	Tune.RWsBoneAngle	= 0			-- Wishbone angle (degrees from horizontal)
	Tune.RAnchorOffset	= {			-- Suspension anchor point offset (relative to center of wheel)
	 --[[Lateral]]		-.4		,	-- positive = outward
	 --[[Vertical]]		-.5		,	-- positive = upward
	 --[[Forward]]		0		}	-- positive = forward

	--Aesthetics	
	Tune.SusVisible		= true			-- Spring Visible
	Tune.WsBVisible		= true			-- Wishbone Visible
	Tune.SusRadius		= .2			-- Suspension Coil Radius
	Tune.SusThickness	= .1			-- Suspension Coil Thickness
	Tune.SusColor		= "Hot pink"	-- Suspension Color [BrickColor]
	Tune.SusCoilCount	= 6				-- Suspension Coil Count
	Tune.WsColor		= "Black"		-- Wishbone Color [BrickColor]
	Tune.WsThickness	= .1			-- Wishbone Rod Thickness
-- find player's head pos



	local vCharacter = Tool.Parent
	local vPlayer = game.Players:playerFromCharacter(vCharacter)

	local head = vCharacter:findFirstChild("Head")
	if head == nil then return end

	local dir = mouse_pos - head.Position
	dir = computeDirection(dir)

	local launch = head.Position + 5 * dir

	local delta = mouse_pos - launch
	
	local dy = delta.y
	
	local new_delta = Vector3.new(delta.x, 0, delta.z)
	delta = new_delta

	local dx = delta.magnitude
	local unit_delta = delta.unit
	
	-- acceleration due to gravity in RBX units
	local g = (-9.81 * 20)

	local theta = computeLaunchAngle( dx, dy, g)

	local vy = math.sin(theta)
	local xz = math.cos(theta)
	local vx = unit_delta.x * xz
	local vz = unit_delta.z * xz
	

	local missile = Pellet:clone()

	missile.Position = launch
	missile.Velocity = Vector3.new(vx,vy,vz) * VELOCITY

	missile.Bomb.Disabled = false

	local creator_tag = Instance.new("ObjectValue")
	creator_tag.Value = vPlayer
	creator_tag.Name = "creator"
	creator_tag.Parent = missile
	
	missile.Parent = game.Workspace

	missile:SetNetworkOwner(vPlayer)

end


function computeLaunchAngle(dx,dy,grav)
	-- arcane
	-- http://en.wikipedia.org/wiki/Trajectory_of_a_projectile
	
	local g = math.abs(grav)
	local inRoot = (VELOCITY*VELOCITY*VELOCITY*VELOCITY) - (g * ((g*dx*dx) + (2*dy*VELOCITY*VELOCITY)))
	if inRoot <= 0 then
		return .25 * math.pi
	end
	local root = math.sqrt(inRoot)
	local inATan1 = ((VELOCITY*VELOCITY) + root) / (g*dx)

	local inATan2 = ((VELOCITY*VELOCITY) - root) / (g*dx)
	local answer1 = math.atan(inATan1)
	local answer2 = math.atan(inATan2)
	if answer1 < answer2 then return answer1 end
	return answer2
end

function computeDirection(vec)
	local lenSquared = vec.magnitude * vec.magnitude
	local invSqrt = 1 / math.sqrt(lenSquared)
	return Vector3.new(vec.x * invSqrt, vec.y * invSqrt, vec.z * invSqrt)
end




Tool.Enabled = true
function onActivated()

	if not Tool.Enabled then
		return
	end

	Tool.Enabled = false

	local character = Tool.Parent;
	local humanoid = character.Humanoid
	if humanoid == nil then
		print("Humanoid not found")
		return 
	end

	local targetPos = script.Parent.Info:InvokeClient((game.Players:GetPlayerFromCharacter(character)), true) -- humanoid.TargetPoint

	fire(targetPos)

	wait(.2)

	Tool.Enabled = true
end

script.Parent.Activated:connect(onActivated)
--edit the below function to execute code when this response is chosen OR this prompt is shown
--player is the player speaking to the dialogue, and dialogueFolder is the object containing the dialogue data


return function(player, dialogueFolder)
	local plrData = require(game.ReplicatedStorage.Source.Modules.Util):GetPlayerData(player)
	plrData.Money.Gold.Value = plrData.Money.Gold.Value - 100 -- TODO track for dissertation
	local ClassInformationTable = require(game.ReplicatedStorage.Source.Modules.CharacterScripts.Classes.ClassInformation)
	ClassInformationTable:GetClassFolder(player,"Mage").Obtained.Value = true
	ClassInformationTable:GetClassFolder(player,"Mage").Glacies.Value = true
	
end