Pinkstack/roblox-luau-corpus-text huggingface dataset:
--[ Hooks ]--
-- Controls


Mouse.KeyDown:connect(function(Key)
	if (Hold ~= nil) then return end
	if (string.upper(Key) ~= "Z") and (string.lower(Key) ~= " ") then return end
	Hold = true

	if (Torso:FindFirstChild("LegWeld") == nil) and (string.lower(Key) ~= " ") then
		-- Right Leg
		RH.Part1 = nil
		CreateWeld(RL, CFrame.new(-0.4, 1.25, 0.5) * CFrame.fromEulerAnglesXYZ(math.rad(90),-0.25,0))

		-- Left Leg
		LH.Part1 = nil
		CreateWeld(LL, CFrame.new(0.4, 1.25, 0.5) * CFrame.fromEulerAnglesXYZ(math.rad(90),0.25,0))
		
		-- Lower Character
		RJ.C0 = CFrame.new(0, -2, 0) * CFrame.Angles(0, 0, 0)
		RJ.C1 = CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0)
		
		-- Slow Walk Speed
		Humanoid.CameraOffset = Vector3.new(0, -2, 0)
		Humanoid.WalkSpeed = 4
		
	else
		StandUp()
		Humanoid.WalkSpeed = 16
		-- Normal Walk Speed
		if Humanoid.CameraOffset == Vector3.new(0,1.25,0) then
		Humanoid.CameraOffset = Vector3.new(0, 0, 0)
		Humanoid.WalkSpeed = 16
		end
		
		
	end

	wait(0.5)

	Hold = nil
end)
-- Domukas3123 click regen script 
-- just place the button to the model



location = script.Parent.Parent.Parent
regen = script.Parent.Parent
save = regen:clone()

function onClicked()
	back = save:clone()
	back.Parent = location
	back:MakeJoints()
end 

script.Parent.ClickDetector.MouseClick:connect(onClicked)
-------- OMG HAX



r = game:service("RunService")


local damage = 5


local slash_damage = 13
local lunge_damage = 17

sword = script.Parent.Handle
Tool = script.Parent


local SlashSound = Instance.new("Sound")
SlashSound.SoundId = "rbxasset://sounds\\swordslash.wav"
SlashSound.Parent = sword
SlashSound.Volume = .7

local LungeSound = Instance.new("Sound")
LungeSound.SoundId = "rbxasset://sounds\\swordlunge.wav"
LungeSound.Parent = sword
LungeSound.Volume = .6

local UnsheathSound = Instance.new("Sound")
UnsheathSound.SoundId = "rbxasset://sounds\\unsheath.wav"
UnsheathSound.Parent = sword
UnsheathSound.Volume = 1


function blow(hit)
	local humanoid = hit.Parent:findFirstChild("Humanoid")
	local vCharacter = Tool.Parent
	local vPlayer = game.Players:playerFromCharacter(vCharacter)
	local hum = vCharacter:findFirstChild("Humanoid") -- non-nil if tool held by a character
	if humanoid~=nil and humanoid ~= hum and hum ~= nil then
		-- final check, make sure sword is in-hand

		local right_arm = vCharacter:FindFirstChild("Right Arm")
		if (right_arm ~= nil) then
			local joint = right_arm:FindFirstChild("RightGrip")
			if (joint ~= nil and (joint.Part0 == sword or joint.Part1 == sword)) then
				tagHumanoid(humanoid, vPlayer)
				humanoid:TakeDamage(damage)
				wait(1)
				untagHumanoid(humanoid)
			end
		end


	end
end


function tagHumanoid(humanoid, player)
	local creator_tag = Instance.new("ObjectValue")
	creator_tag.Value = player
	creator_tag.Name = "creator"
	creator_tag.Parent = humanoid
end

function untagHumanoid(humanoid)
	if humanoid ~= nil then
		local tag = humanoid:findFirstChild("creator")
		if tag ~= nil then
			tag.Parent = nil
		end
	end
end


function attack()
	damage = slash_damage
	SlashSound:play()
	local anim = Instance.new("StringValue")
	anim.Name = "toolanim"
	anim.Value = "Slash"
	anim.Parent = Tool
end

function lunge()
	damage = lunge_damage

	LungeSound:play()

	local anim = Instance.new("StringValue")
	anim.Name = "toolanim"
	anim.Value = "Lunge"
	anim.Parent = Tool
	
	
	force = Instance.new("BodyVelocity")
	force.velocity = Vector3.new(0,10,0) --Tool.Parent.Torso.CFrame.lookVector * 80
	force.Parent = Tool.Parent.Torso
	wait(.3)
	swordOut()
	wait(.3)
	force.Parent = nil
	wait(.5)
	swordUp()

	damage = slash_damage
end

function swordUp()
	Tool.GripForward = Vector3.new(-1,0,0)
	Tool.GripRight = Vector3.new(0,1,0)
	Tool.GripUp = Vector3.new(0,0,1)
end

function swordOut()
	Tool.GripForward = Vector3.new(0,0,1)
	Tool.GripRight = Vector3.new(0,-1,0)
	Tool.GripUp = Vector3.new(-1,0,0)
end

function swordAcross()
	-- parry
end


Tool.Enabled = true
local last_attack = 0
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

	t = r.Stepped:wait()

	if (t - last_attack < .2) then
		lunge()
	else
		attack()
	end

	last_attack = t

	wait(.5)

	Tool.Enabled = true
end


function onEquipped()
	UnsheathSound:play()
end


script.Parent.Activated:connect(onActivated)
script.Parent.Equipped:connect(onEquipped)


connection = sword.Touched:connect(blow)
-- On Startup


for _, anim in ipairs(replacementAnimations) do
	--Check if there is an animation to load, if so, continue this script.
	if anim.id ~= "" then
		print("Valid Animation ID found. Replacing default animation")
		anim.isLoaded = true
	else
		warn(anim.name.." animation ID is blank. Keeping default animation")
	end	
end
-- Connection class


local Connection = {}
Connection.__index = Connection

function Connection.new(signal, fn)
	return setmetatable({
		_connected = true,
		_signal = signal,
		_fn = fn,
		_next = false,
	}, Connection)
end

function Connection:Disconnect()
	assert(self._connected, "Can't disconnect a connection twice.", 2)
	self._connected = false

	-- Unhook the node, but DON'T clear it. That way any fire calls that are
	-- currently sitting on this node will be able to iterate forwards off of
	-- it, but any subsequent fire calls will not hit it, and it will be GCed
	-- when no more fire calls are sitting on it.
	if self._signal._handlerListHead == self then
		self._signal._handlerListHead = self._next
	else
		local prev = self._signal._handlerListHead
		while prev and prev._next ~= self do
			prev = prev._next
		end
		if prev then
			prev._next = self._next
		end
	end
end
--[[Misc]]

--
	Tune.LoadDelay	= 1 			-- Delay before initializing chassis (in seconds, increase for more reliable initialization)
	Tune.AutoStart	= false 			-- Set to false if using manual ignition plugin
	Tune.AutoUpdate	= true			-- Automatically applies minor updates to the chassis if any are found.
									-- Will NOT apply major updates, but will notify you of any.
									-- Set to false to mute notifications, or if using modified Drive.
									
	Tune.Debug		= false			-- Enable to see all of the chassis parts upon initialization.
									-- Useful for tuning the chassis until perfect.
									-- Will turn on any value with the label (Debug)
-- This function converts 4 different, redundant enumeration types to one standard so the values can be compared


function CameraUtils.ConvertCameraModeEnumToStandard(enumValue: 
		Enum.TouchCameraMovementMode | 
		Enum.ComputerCameraMovementMode | 
		Enum.DevTouchCameraMovementMode |
		Enum.DevComputerCameraMovementMode): Enum.ComputerCameraMovementMode | Enum.DevComputerCameraMovementMode
	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
--These values are angles, so a good value for very strong wind is 45
-----------------
--[[MAIN CODE]]--
-----------------


function CircleCFrame(Origin) --Able to cast a CFrame in a circle around an origin point.
	local X = math.random(0, EffectRadius) - (EffectRadius / 2)
	local Z = math.random(0, EffectRadius) - (EffectRadius / 2)
	local Y = math.random(0, EffectRadius) + 5
	return CFrame.new(Origin) * CFrame.new(X, Y, Z)
end

function CreateRain(OriginPoint)
	--Create
	local Part = Instance.new("Part")
	Part.TopSurface = Enum.SurfaceType.Smooth
	Part.BottomSurface = Enum.SurfaceType.Smooth
	Part.CanCollide = false
	Part.Size = Vector3.new(DropWidth, DropLength, DropWidth)
	Part.Color = Color
	Part.Material = Material
	Part.Transparency = 0.25
	Part.CFrame = CircleCFrame(OriginPoint)
	Part.Orientation = Vector3.new(X_SPEED, 0, Z_SPEED)
	Part.Velocity = Part.CFrame.upVector * -100

	--Parent
	Part.Parent = workspace.CurrentCamera
	
	game:GetService("Debris"):AddItem(Part, 10)
end

while wait(1/Rate) do
	CreateRain(workspace.CurrentCamera.CoordinateFrame.p)
end
--02fzx



local FlingAmount = 555 	--sky
local sound = true			--well i mean its overkill so..
local sit = false			--If it makes the player sit.
local e = false				--Do not change.
local explode = true		--This one just kills you



function hit(Touch) 
	local blender = Touch.Parent:FindFirstChild("Head") 
	if not (blender == nil) then
		if e == false then
		e = true
		local bv = Instance.new("BodyVelocity")
		bv.P = 1250
		bv.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
		bv.Velocity = blender.CFrame.lookVector*-FlingAmount
		bv.Parent = blender
		if sit == true then
		Touch.Parent:FindFirstChild("Humanoid").Sit = true
		end
		if sound == true then
				local s = script.Parent.Yeet:Clone()
				local MAAAA = script.Parent.Scream:Clone()
			local random = math.random(8,12)/10
			s.Parent = blender
			s.PlaybackSpeed = 1
				s:Play()
				Touch.Parent:FindFirstChild("Humanoid").Health = 1
				MAAAA.Parent = blender
				MAAAA:Play()
				MAAAA.STOP.Disabled = false
		end
		wait(.05)
		bv:Destroy()
		wait(.2)
	
	e = false
		wait(1)
		if explode == true then
			Touch.Parent:FindFirstChild("Humanoid").Health = 1 
		end



		end
	end 
end

script.Parent.Touched:connect(hit)
-- Fire with stock ray


function FastCast:Fire(origin, directionWithMagnitude, velocity, cosmeticBulletObject, ignoreDescendantsInstance, ignoreWater, bulletAcceleration, bulletData, whizData, hitData, penetrationData)
	assert(getmetatable(self) == FastCast, ERR_NOT_INSTANCE:format("Fire", "FastCast.new()"))
	BaseFireMethod(self, origin, directionWithMagnitude, velocity, cosmeticBulletObject, ignoreDescendantsInstance, ignoreWater, bulletAcceleration, bulletData, whizData, hitData, nil, nil, penetrationData)
end
-- Requires


LoadSceneRemoteEventModule.DefaultLoadScene = require(script.Parent.Parent.Utilities.DefaultLoadScene)
LoadSceneRemoteEventModule.GetSceneByName = require(script.Parent.Parent.Modules.GetSceneByName)
LoadSceneRemoteEventModule.UpdateLightModule = require(script.Parent.UpdateLightingModule)
local enums = require(script.Parent.Parent.enums)
--Rescripted by Luckymaxer



Functions = {}

Players = game:GetService("Players")
Debris = game:GetService("Debris")

ProjectileNames = {"Water", "Arrow", "Projectile", "Effect", "Rail", "Laser", "Bullet"}

function Functions.IsTeamMate(Player1, Player2)
	return (Player1 and Player2 and not Player1.Neutral and not Player2.Neutral and Player1.TeamColor == Player2.TeamColor)
end

function Functions.Round(Number, Decimal)
	Decimal = (Decimal or 0)
	local Multiplier = (10 ^ Decimal)
	return (math.floor(Number * Multiplier + 0.5) / Multiplier)
end

function Functions.SigNum(Number)
	if Number == 0 then
		return 1
	end
	return (math.abs(Number) / Number)
end

function Functions.TagHumanoid(humanoid, player)
	local Creator_Tag = Instance.new("ObjectValue")
	Creator_Tag.Name = "creator"
	Creator_Tag.Value = player
	Debris:AddItem(Creator_Tag, 2)
	Creator_Tag.Parent = humanoid
end

function Functions.UntagHumanoid(humanoid)
	for i, v in pairs(humanoid:GetChildren()) do
		if v:IsA("ObjectValue") and v.Name == "creator" then
			v:Destroy()
		end
	end
end

function Functions.FindCharacterAncestor(Object)
	if Object and Object ~= game:GetService("Workspace") then
		if Object:FindFirstChild("Humanoid") then
			return Object
		else
			return Functions.FindCharacterAncestor(Object.Parent)
		end
	end
	return nil
end

function Functions.WeldBetween(Part1, Part2)
    local Weld = Instance.new("Weld")
    Weld.Part0 = Part1
    Weld.Part1 = Part2
    Weld.C0 = CFrame.new()
    Weld.C1 = Part2.CFrame:inverse() * Part1.CFrame
    Weld.Parent = Part1
    return Weld
end

function CheckTableForString(Table, String)
	for i, v in pairs(Table) do
		if string.lower(v) == string.lower(String) then
			return true
		end
	end
	return false
end

function CheckIntangible(Hit)
	if Hit and Hit.Parent then
		if Hit.Transparency > 0.8 or CheckTableForString(ProjectileNames, Hit.Name) then
			return true
		end
	end
	return false
end

function Functions.CastRay(StartPos, Vec, Length, Ignore, DelayIfHit)
	local Ignore = ((type(Ignore) == "table" and Ignore) or {Ignore})
	local RayHit, RayPos, RayNormal = game:GetService("Workspace"):FindPartOnRayWithIgnoreList(Ray.new(StartPos, Vec * Length), Ignore)
	if RayHit and CheckIntangible(RayHit) then
		if DelayIfHit then
			wait()
		end
		RayHit, RayPos, RayNormal = Functions.CastRay((RayPos + (Vec * 0.01)), Vec, (Length - ((StartPos - RayPos).magnitude)), Ignore, DelayIfHit)
	end
	return RayHit, RayPos, RayNormal
end

return Functions
-- 7 SEGMENT / 30 CHARACTERS



display = {
	{1, 2, 3, 4, 5, 6},    -- 0
	{2, 3},                -- 1
	{1, 2, 4, 5, 7},       -- 2
	{1, 2, 3, 4, 7},       -- 3
	{2, 3, 6, 7},          -- 4
	{1, 3, 4, 6, 7},       -- 5
	{1, 3, 4, 5, 6, 7},    -- 6
	{1, 2, 3},             -- 7
	{1, 2, 3, 4, 5, 6, 7}, -- 8
	{1, 2, 3, 4, 6, 7},    -- 9
	{1, 2, 3, 5, 6, 7},    -- A
	{3, 4, 5, 6, 7},       -- B
	{1, 4, 5, 6},          -- C
	{4, 5, 7},             -- c (Lowercase)
	{2, 3, 4, 5, 7},       -- D
	{1, 4, 5, 6, 7},       -- E
	{1, 2, 4, 5, 6, 7},    -- e (Lowercase)
	{1, 5, 6, 7},          -- F
	{2, 3, 5, 6, 7},       -- H
	{2, 3, 4, 5},          -- J
	{4, 5, 6},             -- L
	{3, 5, 7},             -- n
	{3, 4, 5, 7},          -- o
	{1, 2, 5, 6, 7},       -- P
	{5, 7},                -- r
	{4, 5, 6, 7},          -- t
	{2, 3, 4, 5, 6},       -- U
	{3, 4, 5},             -- u (Lowercase)
	{2, 3, 4, 6, 7},       -- y
	{}                     -- Blank
}

function clear()
	for _,a in pairs(script.Parent:GetChildren()) do if a.ClassName == "Frame" then
		a.Visible = false
	end end
end

script.Parent.Value.Changed:connect(function()
	if script.Parent.Value.Value <= #display and script.Parent.Value.Value > 0 then
		clear()
		for _,b in pairs(display[script.Parent.Value.Value]) do
			script.Parent[tostring(b)].Visible = true
		end
	end
end)
--[[ 
strings-override
Theta Technologies 2021
eFlex Next Generation
It's all at the door...
]]



local doorvalue = script.Parent.Parent.Parent.Outputs.DoorOpen

function MoveDoor(angle)
	local tweenservice = game:GetService("TweenService")
	local tweeninfo = TweenInfo.new(2.5 , Enum.EasingStyle.Sine , Enum.EasingDirection.InOut)
	local tween = tweenservice:Create(script.Parent.Door.Hinge.HingeConstraint , tweeninfo , {TargetAngle = angle})
	tween:Play()
end

doorvalue.Changed:Connect(function(newdoorvalue)
	wait(0.5)
	if script.Parent.Parent.Parent.Outputs.DoorOpen.Value == false then
		MoveDoor(0)
		return
	end
	if newdoorvalue then
		MoveDoor(90)
	else
		MoveDoor(0)
	end
end)
-- Management of which options appear on the Roblox User Settings screen


do
	local PlayerScripts = Players.LocalPlayer:WaitForChild("PlayerScripts")

	PlayerScripts:RegisterTouchCameraMovementMode(Enum.TouchCameraMovementMode.Default)
	PlayerScripts:RegisterTouchCameraMovementMode(Enum.TouchCameraMovementMode.Follow)
	PlayerScripts:RegisterTouchCameraMovementMode(Enum.TouchCameraMovementMode.Classic)

	PlayerScripts:RegisterComputerCameraMovementMode(Enum.ComputerCameraMovementMode.Default)
	PlayerScripts:RegisterComputerCameraMovementMode(Enum.ComputerCameraMovementMode.Follow)
	PlayerScripts:RegisterComputerCameraMovementMode(Enum.ComputerCameraMovementMode.Classic)
	if FFlagUserCameraToggle then
		PlayerScripts:RegisterComputerCameraMovementMode(Enum.ComputerCameraMovementMode.CameraToggle)
	end
end


function CameraModule.new()
	local self = setmetatable({},CameraModule)

	-- Current active controller instances
	self.activeCameraController = nil
	self.activeOcclusionModule = nil
	self.activeTransparencyController = nil
	self.activeMouseLockController = nil

	self.currentComputerCameraMovementMode = nil

	-- Connections to events
	self.cameraSubjectChangedConn = nil
	self.cameraTypeChangedConn = nil

	-- Adds CharacterAdded and CharacterRemoving event handlers for all current players
	for _,player in pairs(Players:GetPlayers()) do
		self:OnPlayerAdded(player)
	end

	-- Adds CharacterAdded and CharacterRemoving event handlers for all players who join in the future
	Players.PlayerAdded:Connect(function(player)
		self:OnPlayerAdded(player)
	end)

	self.activeTransparencyController = TransparencyController.new()
	self.activeTransparencyController:Enable(true)
--Weld stuff here



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)
--Rescripted by Luckymaxer



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

Players = game:GetService("Players")

ServerControl = Tool:WaitForChild("ServerControl")
ClientControl = Tool:WaitForChild("ClientControl")

ClientControl.OnClientInvoke = (function(Mode, Value)
	if Mode == "PlaySound" and Value then
		Value:Play()
	end
end)

function InvokeServer(Mode, Value, arg)
	pcall(function()
		ServerControl:InvokeServer(Mode, Value, arg)
	end)
end

function Equipped(Mouse)
	local Character = Tool.Parent
	local Player = Players:GetPlayerFromCharacter(Character)
	local Humanoid = Character:FindFirstChild("Humanoid")
	if not Player or not Humanoid or Humanoid.Health == 0 then
		return
	end
	Mouse.Button1Down:connect(function()
		InvokeServer("Click", true, Mouse.Hit.p)
	end)
end

local function Unequipped()
	
end

Tool.Equipped:connect(Equipped)
Tool.Unequipped:connect(Unequipped)
 																																																																																																	--[[ 																																																																																																					]]
--[[Transmission]]


	Tune.TransModes		= {"Auto", "Semi", "Manual"}								--[[
	[Modes]
		"Auto"		: Automatic shifting
		"Semi"		: Clutchless manual shifting, dual clutch transmission
		"Manual"	: Manual shifting with clutch
		
		>Include within brackets
			eg: {"Semi"} or {"Auto", "Manual"}								
		>First mode is default mode													]]
	
	--Automatic Settings
	Tune.AutoShiftMode	= "Speed"												--[[
	[Modes]
		"Speed"		: Shifts based on wheel speed
		"RPM"		: Shifts based on RPM											]]	
	Tune.AutoUpThresh	= -200		--Automatic upshift point 	(relative to peak RPM, positive = Over-rev)
	Tune.AutoDownThresh = 1400		--Automatic downshift point (relative to peak RPM, positive = Under-rev)
	
	--Gear Ratios
	Tune.FinalDrive		= 4.06			-- Gearing determines top speed and wheel torque
	Tune.Ratios			= {				-- Higher ratio = more torque, Lower ratio = higher top speed
		--[[Reverse]]	3.70		,	-- Copy and paste a ratio to add a gear
		--[[Neutral]]	0			,	-- Ratios can also be deleted
		--[[ 1 ]]		3.5		,	-- Reverse, Neutral, and 1st gear are required
		--[[ 2 ]]		2		,
		--[[ 3 ]]		1.5		,
		--[[ 4 ]]		1.1		,
		--[[ 5 ]]		0.8		,
	}
	Tune.FDMult			= 1.5			-- Ratio multiplier (Change this value instead of FinalDrive if car is struggling with torque ; Default = 1)
-- Input end


userInputService.InputEnded:connect(function(inputObject, gameProcessedEvent)
	if inputObject.KeyCode == Enum.KeyCode.W then
		if movement.Y == 1 then
			movement = Vector2.new(movement.X, 0)
		end
	elseif inputObject.KeyCode == Enum.KeyCode.A then
		if movement.X == -1 then
			movement = Vector2.new(0, movement.Y)
		end
	elseif inputObject.KeyCode == Enum.KeyCode.S then
		if movement.Y == -1 then
			movement = Vector2.new(movement.X, 0)
		end
	elseif inputObject.KeyCode == Enum.KeyCode.D then
		if movement.X == 1 then
			movement = Vector2.new(0, movement.Y)
		end
	end
end)

local force = 0
local damping = 0

local mass = 0

for i, v in pairs(car:GetChildren()) do
	if v:IsA("BasePart") then
		mass = mass + (v:GetMass() * 196.2)
	end
end

force = mass * stats.Suspension.Value
damping = force / stats.Bounce.Value

local bodyVelocity = Instance.new("BodyVelocity", car.Chassis)
bodyVelocity.velocity = Vector3.new(0, 0, 0)
bodyVelocity.maxForce = Vector3.new(0, 0, 0)

local bodyAngularVelocity = Instance.new("BodyAngularVelocity", car.Chassis)
bodyAngularVelocity.angularvelocity = Vector3.new(0, 0, 0)
bodyAngularVelocity.maxTorque = Vector3.new(0, 0, 0)

local rotation = 0

local function UpdateThruster(thruster)
	--Make sure we have a bodythrust to move the wheel
	local bodyThrust = thruster:FindFirstChild("BodyThrust")
	if not bodyThrust then
		bodyThrust = Instance.new("BodyThrust", thruster)
	end
	--Do some raycasting to get the height of the wheel
	local hit, position = Raycast.new(thruster.Position, thruster.CFrame:vectorToWorldSpace(Vector3.new(0, -1, 0)) * stats.Height.Value)
	local thrusterHeight = (position - thruster.Position).magnitude
	if hit and hit.CanCollide then
		--If we're on the ground, apply some forces to push the wheel up
		bodyThrust.force = Vector3.new(0, ((stats.Height.Value - thrusterHeight)^2) * (force / stats.Height.Value^2), 0)
		local thrusterDamping = thruster.CFrame:toObjectSpace(CFrame.new(thruster.Velocity + thruster.Position)).p * damping
		bodyThrust.force = bodyThrust.force - Vector3.new(0, thrusterDamping.Y, 0)
	else
		bodyThrust.force = Vector3.new(0, 0, 0)
	end
	
	--Wheels
	local wheelWeld = thruster:FindFirstChild("WheelWeld")
	if wheelWeld then
		wheelWeld.C0 = CFrame.new(0, -math.min(thrusterHeight, stats.Height.Value * 0.8) + (wheelWeld.Part1.Size.Y / 2), 0)
		-- Wheel turning
		local offset = car.Chassis.CFrame:inverse() * thruster.CFrame
		local speed = car.Chassis.CFrame:vectorToObjectSpace(car.Chassis.Velocity)
		if offset.Z < 0 then
			local direction = 1
			if speed.Z > 0 then
				direction = -1
			end
			wheelWeld.C0 = wheelWeld.C0 * CFrame.Angles(0, (car.Chassis.RotVelocity.Y / 2) * direction, 0)
		end
		wheelWeld.C0 = wheelWeld.C0 * CFrame.Angles(rotation, 0, 0)
	end
end