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

--
local BaseCharacterController = {}
BaseCharacterController.__index = BaseCharacterController

function BaseCharacterController.new()
	local self = setmetatable({}, BaseCharacterController)
	self.enabled = false
	self.moveVector = ZERO_VECTOR3
	self.moveVectorIsCameraRelative = true
	self.isJumping = false
	return self
end

function BaseCharacterController:OnRenderStepped(dt)
	-- By default, nothing to do
end

function BaseCharacterController:GetMoveVector()
	return self.moveVector
end

function BaseCharacterController:IsMoveVectorCameraRelative()
	return self.moveVectorIsCameraRelative
end

function BaseCharacterController:GetIsJumping()
	return self.isJumping
end
--[[Standardized Values: Don't touch unless needed]]


	
	--[WEIGHT // Cubic stud : pounds ratio]
	Tune.WeightScaling = 1/50	--Default = 1/50 (1 cubic stud = 50 lbs)
	Tune.LegacyScaling = 1/10	--Default = 1/10 (1 cubic stud = 10 lbs) [PGS OFF]
	--[ENGINE // Caching]
	Tune.CurveCache = true		--Default = true (Caches the engine and boost curves)
	Tune.CacheInc = 100 		--Default = 100 (How many points the curve will have.)
	--[[Examples: 1 = every RPM increment [will freeze your computer at low settings like this], 
				  100 = default and recommended, 
				  1000 or more = death															]]
	
return Tune
--[[Transmission]]


	Tune.TransModes		= {"Auto", "Semi"}								--[[
	[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.53		,	-- Reverse, Neutral, and 1st gear are required
		--[[ 2 ]]		2.04		,
		--[[ 3 ]]		1.38		,
		--[[ 4 ]]		1.13		,
		--[[ 5 ]]		0.63		,
		--[[ 6 ]]		0.47		,
	}
	Tune.FDMult			= 1.5			-- Ratio multiplier (Change this value instead of FinalDrive if car is struggling with torque ; Default = 1)
-- Testing AC FE support



local event = script.Parent
local car=script.Parent.Parent
local LichtNum = 0


event.OnServerEvent:connect(function(player,data)
	if data['ToggleLight'] then
		if car.Body.Light.on.Value==true then
			car.Body.Light.on.Value=false
		else
			car.Body.Light.on.Value=true
		end
	elseif data['EnableBrakes'] then
		car.Body.Brakes.on.Value=true
	elseif data['DisableBrakes'] then
		car.Body.Brakes.on.Value=false
	elseif data['ToggleLeftBlink'] then
		if car.Body.Left.on.Value==true then
			car.Body.Left.on.Value=false
		else
			car.Body.Left.on.Value=true
		end
	elseif data['ToggleRightBlink'] then
		if car.Body.Right.on.Value==true then
			car.Body.Right.on.Value=false
		else
			car.Body.Right.on.Value=true
		end
	elseif data['ReverseOn'] then
		car.Body.Reverse.on.Value=true
	elseif data['ReverseOff'] then
		car.Body.Reverse.on.Value=false
	elseif data['ToggleStandlicht'] then
		if LichtNum == 0 then
			LichtNum = 2
			car.Body.Headlight.on.Value = true
		elseif LichtNum == 1 then
			LichtNum = 2
			car.Body.Headlight.on.Value = true
		elseif LichtNum == 2 then
			LichtNum = 3
			car.Body.Highlight.on.Value = true
		elseif LichtNum == 3 then
			LichtNum = 1
			car.Body.Highlight.on.Value = false
			car.Body.Headlight.on.Value = false
		end
	elseif data["ToggleHazards"] then
		if car.Body.Hazards.on.Value == false then
			car.Body.Hazards.on.Value = true	
		elseif car.Body.Hazards.on.Value == true then
			car.Body.Hazards.on.Value = false
		end
	end
end)
-- ================================================================================
-- LOCAL FUNCTIONS
-- ================================================================================


local function weld(folder, main, parent)		
	for _,child in pairs(parent:GetChildren()) do
		if ((child:IsA("BasePart")) and (child ~= main) and (child.Name ~= "Head") 
			and (child.Name ~= "UpperTorso")) then
			
			local weld = Instance.new("WeldConstraint")
			weld.Parent = folder
			weld.Name = "Weld"
			weld.Part0, weld.Part1 = child, main
		end
		weld(folder, main, child)
	end
end -- weld()
-- Update loop; on every loop, checks if an object should be made and, if so, creates that object


local last = tick()
while wait() do
    local now = tick()
    local delta = now - last

    for _, object in ipairs(fallingStuffTable) do
        if checkIfShouldDrop(object, delta) then
            local obj = object.MODEL:Clone()
            positionFallingObject(obj)
            setupFallingObjectCollisions(obj, object.DAMAGE)
            objectCleanup(obj, object.CLEANUP_DELAY_IN_SECONDS)
        end
    end

    last = now
end
--Kyles45678



if not game:IsLoaded() then
	game.Loaded:Wait()
end

local ply = game.Players.LocalPlayer
local inGame = ply:WaitForChild("InGame")

local repStoreService = game:GetService("ReplicatedStorage")
local userInputService = game:GetService("UserInputService")

local gui = script.Parent

local defaultView = gui.Default
local mobileView = gui.Mobile

local gameFolder = repStoreService:WaitForChild("Game")
local IM = require(gameFolder.Modules:WaitForChild("IsMobile"))

local function toggleGameUI()
	local ism = IM.isMobile()
	defaultView.Visible = not ism
	mobileView.Visible = ism
end

toggleGameUI()

userInputService.InputBegan:Connect(function(inputObj, GPE)
	--if GPE then return end
	if inputObj.UserInputType == Enum.UserInputType.MouseMovement and userInputService.MouseEnabled and mobileView.Visible then
		toggleGameUI()
	elseif inputObj.UserInputType == Enum.UserInputType.Touch and not userInputService.MouseEnabled and defaultView.Visible then
		toggleGameUI()
	end
end)

local function onInGameChange()
	gui.Enabled = inGame.Value
end

inGame.Changed:Connect(onInGameChange)
onInGameChange()
-- functions



function stopAllAnimations()
	local oldAnim = currentAnim

	-- 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
--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").WiseCasting.Value = true
end
-- Public Methods



function SpringClass:Update(dt)
	if (not self.instant) then
		local t, k, d, x0, v0 = self.t, self.k, self.d, self.x, self.v
		local a0 = k*(t - x0) + v0*d
		local v1 = v0 + a0*(dt/2)
		local a1 = k*(t - (x0 + v0*(dt/2))) + v1*d
		local v2 = v0 + a1*(dt/2)
		local a2 = k*(t - (x0 + v1*(dt/2))) + v2*d
		local v3 = v0 + a2*dt
		local x4 = x0 + (v0 + 2*(v1 + v2) + v3)*(dt/6)
		self.x, self.v = x4, v0 + (a0 + 2*(a1 + a2) + k*(t - (x0 + v2*dt)) + v3*d)*(dt/6)
		
		if (getAbsDist(x4, self.t) > self.marginOfError) then
			return x4
		end
	end
	
	self.x, self.v = self.t, self.v*0
	return self.x
end
--Left lean Multiplier


ZR15RightLegLeftLeanM= 1
XR15RightLegLeftLeanM = 1 
YR15RightLegLeftLeanM = 1
R15RightKneeLeftLeanM = 1

ZR15RightArmLeftLeanM = 1
XR15RightArmLeftLeanM = 1
YR15RightArmLeftLeanM = 1
R15RightElbowLeftLeanM = 1

ZR15LeftLegLeftLeanM= 1
XR15LeftLegLeftLeanM = 1 
YR15LeftLegLeftLeanM = 1
R15LeftKneeLeftLeanM = 1

ZR15LeftArmLeftLeanM = 1
XR15LeftArmLeftLeanM = 1
YR15LeftArmLeftLeanM = 1
R15LeftElbowLeftLeanM = 1

ZR15LowerTorsoLeftLeanM = 1
XR15LowerTorsoLeftLeanM = 1
YR15LowerTorsoLeftLeanM = 1
ZR15UpperTorsoLeftLeanM = 1
-- We get the initial shop size for opening the shop frame.


local initialShopSize = shopFrame.Size

isOpen.Changed:Connect(function()
	if isOpen.Value == true then
		-- open

		shopFrame.Visible = true
		shopFrame.Size = UDim2.new(0,0,0,0)

		local shopTweenInfo = TweenInfo.new(0.15, Enum.EasingStyle.Linear)
		local shopTweenGoal = {
			Size = initialShopSize
		}

		local shopTween = ts:Create(shopFrame, shopTweenInfo, shopTweenGoal)
		shopTween:Play()
		shopBtn.TextLabel.Text = "Close Shop"
	elseif isOpen.Value == false then
		-- close

		local shopTweenInfo = TweenInfo.new(0.15, Enum.EasingStyle.Linear)
		local shopTweenGoal = {
			Size = UDim2.new(0,0,0,0)
		}

		local shopTween = ts:Create(shopFrame, shopTweenInfo, shopTweenGoal)
		shopTween:Play()
		-- When the Tween has finished, the shop frame is hidden.
		shopTween.Completed:Connect(function()
			shopFrame.Visible = false
			shopBtn.TextLabel.Text = "Buy Cash!"
		end)
	end
end)

shopBtn.MouseButton1Click:Connect(function()
	-- used to toggle the isOpen value to fire the Changed event.
	if isOpen.Value == true then
		isOpen.Value = false
	elseif isOpen.Value == false then
		isOpen.Value = true
	end
end)
--[[ if your changing the DataStore name from LB 
		to anything else you should change it inside the saving script too
	]]

--
local LeaderBoardStore = DataStore:GetOrderedDataStore("LB")


local function Arrange()
	-- pcall can help us to indentify and silence the errors
	
	local success , errormessage = pcall(function()
		
		local MainPage = LeaderBoardStore:GetSortedAsync(false , 50)
		local ThisPage = MainPage:GetCurrentPage()

		for i , v in pairs(ThisPage) do  
			-- i is the player's rank and v is the player's data

			local Player = game.Players:GetPlayerByUserId(v.key)
			local Coins = v.Value or 0 

			local NewFrame = script:FindFirstChild("Frame"):Clone()
			NewFrame.Player.Text = Player.Name
			NewFrame.Rank.Text = i
			NewFrame.Coins.Text = Coins
			NewFrame.Parent = script.Parent
			
			
			if ChatService then -- first checking if ChatService has loaded or not
				-- Leaderboard tags are added in the below lines
				local Speaker = ChatService:GetSpeaker(Player.Name)
				if Speaker then
					-- You can Change the TagText and TagColor
					Speaker:SetExtraData("Tags" , {{TagText = "#"..i  , TagColor = Color3.fromRGB(0, 255, 127)}})
				end
			end

		end
	end)
	
	if not success then
		-- if there is any error in the script it will warn us here
		warn(errormessage)
	end
	
end

Arrange()
--[[Driver Handling]]


	--Driver Sit	
	car.DriveSeat.ChildAdded:connect(function(child)
		if child.Name=="SeatWeld" and child:IsA("Weld") and game.Players:GetPlayerFromCharacter(child.Part1.Parent)~=nil then
			--Distribute Client Interface
			local p=game.Players:GetPlayerFromCharacter(child.Part1.Parent)
			car.DriveSeat:SetNetworkOwner(p)
			local g=script.Parent["A-Chassis Interface"]:Clone()
			g.Parent=p.PlayerGui
		end
	end)
	
	--Driver Leave
	car.DriveSeat.ChildRemoved:connect(function(child)
		if child.Name=="SeatWeld" and child:IsA("Weld") then
			--Remove Flip Force
			if car.DriveSeat:FindFirstChild("Flip")~=nil then
				car.DriveSeat.Flip.MaxTorque = Vector3.new()
			end
			
			--Remove Wheel Force
			for i,v in pairs(car.Wheels:GetChildren()) do
				if v:FindFirstChild("#AV")~=nil then
					if v["#AV"].AngularVelocity.Magnitude>0 then
						v["#AV"].AngularVelocity = Vector3.new()
						v["#AV"].MaxTorque = Vector3.new()
					end
				end
			end
		end
	end)
-----------------------------------------------





function findAllFlagStands(root)
	local c = root:children()
	for i=1,#c do
		if (c[i].className == "Model" or c[i].className == "Part") then
			findAllFlagStands(c[i])
		end
		if (c[i].className == "FlagStand") then
			table.insert(stands, c[i])
		end
	end
end

function hookUpListeners()
	for i=1,#stands do
		stands[i].FlagCaptured:connect(onCaptureScored)
	end
end

function onPlayerEntered(newPlayer)

	if CTF_mode == true then

		local stats = Instance.new("IntValue")
		stats.Name = "leaderstats"

		local captures = Instance.new("IntValue")
		captures.Name = "Captures"
		captures.Value = 0


		captures.Parent = stats

		-- VERY UGLY HACK
		-- Will this leak threads?
		-- Is the problem even what I think it is (player arrived before character)?
		while true do
			if newPlayer.Character ~= nil then break end
			wait(5)
		end

		stats.Parent = newPlayer

	else

		local stats = Instance.new("IntValue")
		stats.Name = "leaderstats"
		local kills = false
		if Settings.LeaderboardSettings.KOs then
			kills = Instance.new("IntValue")
			kills.Name = Settings.LeaderboardSettings.KillsName
			kills.Value = 0
		end
		local deaths = false
		if Settings.LeaderboardSettings.WOs then
			deaths = Instance.new("IntValue")
			deaths.Name = Settings.LeaderboardSettings.DeathsName
			deaths.Value = 0
		end
		
		local cash = false
		if Settings.LeaderboardSettings.ShowCurrency then
			cash = Instance.new("StringValue")
			cash.Name = Settings.CurrencyName
			cash.Value = 0
		end
		
		local PlayerStats = game.ServerStorage.PlayerMoney:FindFirstChild(newPlayer.Name)
		if PlayerStats ~= nil then
			if cash then
				local Short = Settings.LeaderboardSettings.ShowShortCurrency
				PlayerStats.Changed:connect(function()
					if (Short) then
						cash.Value = Settings:ConvertShort(PlayerStats.Value)
					else
						cash.Value = Settings:ConvertComma(PlayerStats.Value)
					end
				end)
			end
		end
		if kills then
		kills.Parent = stats
		end
		if deaths then
		deaths.Parent = stats
		end
		if cash then
		cash.Parent = stats
		end

		-- VERY UGLY HACK
		-- Will this leak threads?
		-- Is the problem even what I think it is (player arrived before character)?
		while true do
			if newPlayer.Character ~= nil then break end
			wait(5)
		end

		local humanoid = newPlayer.Character.Humanoid

		humanoid.Died:connect(function() onHumanoidDied(humanoid, newPlayer) end )

		-- start to listen for new humanoid
		newPlayer.Changed:connect(function(property) onPlayerRespawn(property, newPlayer) end )


		stats.Parent = newPlayer

	end

end


function onCaptureScored(player)

		local ls = player:findFirstChild("leaderstats")
		if ls == nil then return end
		local caps = ls:findFirstChild("Captures")
		if caps == nil then return end
		caps.Value = caps.Value + 1

end


findAllFlagStands(game.Workspace)
hookUpListeners()
if (#stands > 0) then CTF_mode = true end
game.Players.ChildAdded:connect(onPlayerEntered)
----------------------------------
------------FUNCTIONS-------------
----------------------------------



function UnDigify(digit)
	if digit < 1 or digit > 61 then
		return ""
	elseif digit == 1 then
		return "1"
	elseif digit == 2 then
		return "!"
	elseif digit == 3 then
		return "2"
	elseif digit == 4 then
		return "@"
	elseif digit == 5 then
		return "3"
	elseif digit == 6 then
		return "4"
	elseif digit == 7 then
		return "$"
	elseif digit == 8 then
		return "5"
	elseif digit == 9 then
		return "%"
	elseif digit == 10 then
		return "6"
	elseif digit == 11 then
		return "^"
	elseif digit == 12 then
		return "7"
	elseif digit == 13 then
		return "8"
	elseif digit == 14 then
		return "*"
	elseif digit == 15 then
		return "9"
	elseif digit == 16 then
		return "("
	elseif digit == 17 then
		return "0"
	elseif digit == 18 then
		return "q"
	elseif digit == 19 then
		return "Q"
	elseif digit == 20 then
		return "w"
	elseif digit == 21 then
		return "W"
	elseif digit == 22 then
		return "e"
	elseif digit == 23 then
		return "E"
	elseif digit == 24 then
		return "r"
	elseif digit == 25 then
		return "t"
	elseif digit == 26 then
		return "T"
	elseif digit == 27 then
		return "y"
	elseif digit == 28 then
		return "Y"
	elseif digit == 29 then
		return "u"
	elseif digit == 30 then
		return "i"
	elseif digit == 31 then
		return "I"
	elseif digit == 32 then
		return "o"
	elseif digit == 33 then
		return "O"
	elseif digit == 34 then
		return "p"
	elseif digit == 35 then
		return "P"
	elseif digit == 36 then
		return "a"
	elseif digit == 37 then
		return "s"
	elseif digit == 38 then
		return "S"
	elseif digit == 39 then
		return "d"
	elseif digit == 40 then
		return "D"
	elseif digit == 41 then
		return "f"
	elseif digit == 42 then
		return "g"
	elseif digit == 43 then
		return "G"
	elseif digit == 44 then
		return "h"
	elseif digit == 45 then
		return "H"
	elseif digit == 46 then
		return "j"
	elseif digit == 47 then
		return "J"
	elseif digit == 48 then
		return "k"
	elseif digit == 49 then
		return "l"
	elseif digit == 50 then
		return "L"
	elseif digit == 51 then
		return "z"
	elseif digit == 52 then
		return "Z"
	elseif digit == 53 then
		return "x"
	elseif digit == 54 then
		return "c"
	elseif digit == 55 then
		return "C"
	elseif digit == 56 then
		return "v"
	elseif digit == 57 then
		return "V"
	elseif digit == 58 then
		return "b"
	elseif digit == 59 then
		return "B"
	elseif digit == 60 then
		return "n"
	elseif digit == 61 then
		return "m"
  	else
    	return "?"
	end
end
function IsBlack(note)
	if note%12 == 2 or note%12 == 4 or note%12 == 7 or note%12 == 9 or note%12 == 11 then
		return true
	end
end

local TweenService = game:GetService("TweenService")
function Tween(obj,Goal,Time,Wait,...)
    local TwInfo = TweenInfo.new(Time,...)
    local twn = TweenService:Create(obj, TwInfo, Goal)
    twn:Play()
    if Wait then
        twn.Completed:wait()
    end
	return
end
-- Shapes --


local shapes = {}
for _, v in pairs(script:GetChildren()) do
	table.insert(shapes, v)
end

local colors = {
	[1] = Color3.fromRGB(255,255,255),
	[2] = Color3.fromRGB(255,0,0),
	[3] = Color3.fromRGB(0,255,0),
	[4] = Color3.fromRGB(0,0,255),
	[5] = Color3.fromRGB(255,255,0),
	[6] = Color3.fromRGB(255,0,191),
	[7] = Color3.fromRGB(0, 255, 255),
	[8] = Color3.fromRGB(213, 115, 61),
	[9] = Color3.fromRGB(98, 37, 209),
	[10] = Color3.fromRGB(91, 93, 105),
}

local function getColor()
	local num = math.random(1,10)
	if colors[num] then
		return colors[num]
	end
	return Color3.fromRGB(255,255,255)
end
--------LEFT DOOR --------



game.Workspace.doorleft.l12.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorleft.l21.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorleft.l33.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorleft.l42.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorleft.l51.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorleft.l63.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorleft.l72.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
--// Aim|Zoom|Sensitivity Customization


	ZoomSpeed = 0.05; -- The lower the number the slower and smoother the tween
	AimZoom = 60; -- Default zoom
	AimSpeed = 0.70;
	UnaimSpeed = 0.70;
	CycleAimZoom = 30; -- Cycled zoom
	MouseSensitivity = 0.5; -- Number between 0.1 and 1
	SensitivityIncrement = 0.05; -- No touchy
--bp.Position = shelly.PrimaryPart.Position


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


local soundBank = game.ServerStorage.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 = game.ServerStorage.Items:FindFirstChild("Egg"):Clone()
newEgg.Color = shelly.Torso.Color
newEgg.CFrame = shelly.PrimaryPart.CFrame*CFrame.new(0,3,3)
newEgg.Parent = workspace
local newSound = game.ServerStorage.Sounds.Quicks.Pop:Clone()
newSound.PlayOnRemove = true
newSound.Parent = newEgg
wait()
newSound:Destroy()

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

MoveShelly()
end
--[[Sword Part Class]]

--
	
local SwordPart =
{
	Damage = 50,
	AttackTime = 0.5,
	CoolDown = 0,
	
	LastSwing = 0,
	LastHit = 0,

	Part= nil,
	Owner = nil,--player object that owns this sword
	
	OnHit = nil,
	OnHitHumanoid = nil,
	OnAttackReady = nil,
	OnAttack = nil,
	
	
	SwingSound = nil,
	HitSound = nil,
	SwingAnimation = nil, --animation track!
	
	ActiveConnections = {},
	
}
do
	UTIL.MakeClass(SwordPart)
	function SwordPart.New(npart,nowner)
		local init= UTIL.DeepCopy(SwordPart)
		init.Part= npart
		init.Owner = nowner
		table.insert(init.ActiveConnections,init.Part.Touched:connect(function(hit) init:SwordTouch(hit) end))
		
		init.OnHit = InternalEvent.New()
		init.OnHitHumanoid = InternalEvent.New()
		init.OnAttackReady = InternalEvent.New()
		init.OnAttack = InternalEvent.New()
		
		return init
	end
	
	function SwordPart:SwordTouch(hit)
		if tick()-self.LastSwing >self.AttackTime or tick()-self.LastHit<self.AttackTime then return end
		self.OnHit:Fire(hit)
		local character,humanoid = UTIL.FindCharacterAncestor(hit)
		if character and character ~= self.Owner.Character then
			humanoid:TakeDamage(self.Damage)
			self.OnHitHumanoid:Fire(humanoid,hit)
			self.LastHit = tick()
			if self.HitSound then
				self.HitSound:Play()
			end
		end
		
	end
	
	function SwordPart:DoSwing()
		if tick()-self.LastSwing<self.AttackTime+self.CoolDown then
			return
		end
		
		if self.SwingAnimation then
			self.SwingAnimation:Play()
		end
		if self.SwingSound then
			self.SwingSound:Play()
		end
		self.LastSwing = tick()
		self.OnAttack:Fire()
	end
	
	function SwordPart:Destroy()
		for _,i in pairs(self.ActiveConnections) do
			i:disconnect()
		end
	end
end
do
	local Handle = script.Parent
	local Tool = Handle.Parent
	
	local Player = game.Players.LocalPlayer
	local Character = UTIL.WaitForValidCharacter(Player)
	local SwingAni = UTIL.Instantiate"Animation"
	{AnimationId = "http://www.roblox.com/Asset?ID=89289879"}
	
	local HitSound = Handle:WaitForChild('Hit')
	local SwingSound = Handle:WaitForChild('Swing')
	
	local SwingAniTrack
	
	local Sword
	
	
	Tool.Equipped:connect(function(mouse)
		Sword = SwordPart.New(Handle,Player)
		Sword.Damage = 40
		Sword.HitSound = HitSound
		Sword.SwingSound = SwingSound
		Character = UTIL.WaitForValidCharacter(Player)
		local Humanoid = Character:FindFirstChild('Humanoid')

		SwingAniTrack = Humanoid:LoadAnimation(SwingAni)
		Sword.SwingAnimation = SwingAniTrack
		
		Sword.OnHitHumanoid:Connect(function(humanoid,hit)
			local myTorso = Character:FindFirstChild('Torso')
			local torso = humanoid.Parent:FindFirstChild('Torso')
			if not torso or not myTorso then return end
			
			if hit.Name=='Right Arm' or hit.Name=='Left Arm' or hit.Name=='Right Leg' or hit.Name=='Left Leg' then
				hit:BreakJoints()
				WeldUtil.WeldBetween(hit, Handle)
				Delay(1,function() hit:BreakJoints() end )
			end
		end)
		
		mouse.Button1Down:connect(function()
			Sword:DoSwing()
		end)
	end)
	Tool.Unequipped:connect(function()
		Sword:Destroy()
	end)

end
--edit the function below to return true when you want this response/prompt to be valid
--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)
	return plrData.Classes.Super.PureKnight.Obtained.Value ~= true
end