Pinkstack/roblox-luau-corpus-text huggingface dataset:
-- Place in StarterGui



local Amount = 5		-- Amount of drops to generate per .03 seconds
local Distance = 50		-- Distance from player on the x and z axis
local Height = 60		-- Distance from player on the y axis

local RainDrop = Instance.new("Part")
RainDrop.CanCollide = false
RainDrop.BrickColor = BrickColor.new("Pastel light blue")
RainDrop.FormFactor = "Custom"
RainDrop.Size = Vector3.new(.2, 1.2, .2)
RainDrop.BottomSurface = "Smooth"
RainDrop.TopSurface = "Smooth"
RainDrop.Transparency = .5
local Mesh = Instance.new("BlockMesh")
Mesh.Scale = Vector3.new(.4, 2, .4)
Mesh.Parent = RainDrop

while wait() do
	for i = 1, Amount do
		local drop = RainDrop:Clone()
		drop.Parent = game.Workspace.CurrentCamera
		drop.CFrame = game.Players.LocalPlayer.Character.Torso.CFrame + Vector3.new(math.random(-Distance, Distance), Height ,math.random(-Distance, Distance))
		game:GetService("Debris"):AddItem(drop, 3)
		drop.Touched:connect(function()
			drop:Remove()
		end)
	end
end
-- Returns the ancestor that contains a Humanoid, if it exists


local function FindCharacterAncestor(subject)
	if subject and subject ~= Workspace then
		local humanoid = subject:FindFirstChild('Humanoid')
		if humanoid then
			return subject, humanoid
		else
			return FindCharacterAncestor(subject.Parent)
		end
	end
	return nil
end

local function OnExplosionHit(hitPart)
	if hitPart then
		local _, humanoid = FindCharacterAncestor(hitPart.Parent)
		if humanoid and humanoid.Health > 0 and not hitPart:IsDescendantOf(CreatorTag.Value.Character) then
			CreatorTag:Clone().Parent=humanoid
			humanoid:TakeDamage(100)
		end
	end
end

local function OnTouched(otherPart)
	if Rocket and otherPart then
		-- Fly through anything in the ignore list
		if IGNORE_LIST[string.lower(otherPart.Name)] then
			return
		end

		-- Fly through the creator
		local myPlayer = CreatorTag.Value
		if myPlayer and myPlayer.Character and myPlayer.Character:IsAncestorOf(otherPart) then
			return
		end
		
		OnExplosionHit(hitPart)
		
		-- Boom
		local explosion = Instance.new('Explosion')
		explosion.BlastPressure = BLAST_PRESSURE
		explosion.BlastRadius = BLAST_RADIUS
		-- todo configure based on proximity
		explosion.DestroyJointRadiusPercent = 0
		
		explosion.Position = Rocket.Position
		explosion.Hit:connect(OnExplosionHit)
		explosion.Parent = Workspace

		-- Move this script and the creator tag (so our custom logic can execute), then destroy the rocket
		script.Parent = explosion
		CreatorTag.Parent = script
		Rocket:Destroy()
	end
end
---------------------------------------------------



local tweenService = game:GetService("TweenService")
This = script.Parent
Lift = This.Parent.Parent.Parent

for i,v in pairs(Lift.Car:WaitForChild("Welds"):GetChildren()) do
	if v.Part1 == script.Parent.Button then v:Destroy() end
end
local weld = Instance.new("ManualWeld", This.Button)
weld.C0 = Lift.Car.Platform.CFrame:inverse() * This.Button.CFrame
weld.Part0 = Lift.Car.Platform
weld.Part1 = This.Button
click = false

for x,x in pairs(This.Button:GetChildren()) do 
	if x:IsA("SurfaceGui") and x.Name == ("Button") then 
		x.Button.MouseButton1Click:connect(function()
			if click == false then
				click = true
				tweenService:Create(weld,TweenInfo.new(0.1),{
					["C1"] = weld.C1*CFrame.new(-0.003, 0, 0),
				}):Play()
				wait(0.1)
				tweenService:Create(weld,TweenInfo.new(0.1),{
					["C1"] = weld.C1*CFrame.new(0.003, 0, 0),
				}):Play()
				wait(0.1)
				click = false
			end
		end)
	end
end
--[[function TweenProperty(obj, propName, inita, enda, length,sentinel)
	local startTime = tick()
	local mySentinel = sentinel.Value
	local diff = enda-inita
	while tick()-startTime<length and mySentinel==sentinel.Value do
		obj[propName] = (((tick()-startTime)/length)*diff)+inita
		wait(1/30)
	end
	obj[propName] = enda	
end]]
-- Indexes in sequence a of last point of forward or reverse paths in graph.
-- Myers algorithm indexes by diagonal k which for negative is bad deopt in V8.
-- This package indexes by iF and iR which are greater than or equal to zero.
-- and also updates the index arrays in place to cut memory in half.
-- kF = 2 * iF - d
-- kR = d - 2 * iR


type Indexes = Array<number>
-- Relationship in notation between Myers paper and this package:
-- A is a
-- N is aLength, aEnd - aStart, and so on
-- x is aIndex, aFirst, aLast, and so on
-- B is b
-- M is bLength, bEnd - bStart, and so on
-- y is bIndex, bFirst, bLast, and so on
-- Δ = N - M is negative of baDeltaLength = bLength - aLength
-- D is d
-- k is kF
-- k + Δ is kF = kR - baDeltaLength
-- V is aIndexesF or aIndexesR (see comment below about Indexes type)
-- index intervals [1, N] and [1, M] are [0, aLength) and [0, bLength)
-- starting point in forward direction (0, 0) is (-1, -1)
-- starting point in reverse direction (N + 1, M + 1) is (aLength, bLength)
---To Add More Songs, Follow This Format:---
---local Song(Number) = SongFolder.(SongName)




	Song1.Playing = true ---Just Started Playing The Song---
	wait (Song1.TimeLength) ---Wait Length Of Song---
	Song1.Playing = false ---Just Stopped Playing The Song---
	
	Song2.Playing = true ---Just Started Playing The Song---
	print ("2")
	wait (Song2.TimeLength) ---Wait Length Of Song---
	Song2.Playing = false ---Just Stopped Playing The Song---

Song3.Playing = true ---Just Started Playing The Song---
	wait (Song3.TimeLength) ---Wait Length Of Song---
	Song3.Playing = false ---Just Stopped Playing The Song---

Song4.Playing = true ---Just Started Playing The Song---
	wait (Song4.TimeLength) ---Wait Length Of Song---
	Song4.Playing = false ---Just Stopped Playing The Song---
	
	Song5.Playing = true ---Just Started Playing The Song---
	wait (Song5.TimeLength) ---Wait Length Of Song---
	Song5.Playing = false ---Just Stopped Playing The Song---
	
	Song6.Playing = true ---Just Started Playing The Song---
	wait (Song6.TimeLength) ---Wait Length Of Song---
	Song6.Playing = false ---Just Stopped Playing The Song---

Song7.Playing = true ---Just Started Playing The Song---
	wait (Song7.TimeLength) ---Wait Length Of Song---
	Song7.Playing = false ---Just Stopped Playing The Song---


Song8.Playing = true ---Just Started Playing The Song---
	wait (Song8.TimeLength) ---Wait Length Of Song---
	Song8.Playing = false ---Just Stopped Playing The Song---



until game.Workspace.SongScript.Disabled == true ---Don't stop playing the songs until script is disabled---
--Feel free to delete the 'ThumbnailCamera' and 'Part'. I use this for the model's thumbnail.




	
local part = workspace["HD Admin"].ThumbnailCamera.Part
local camera = game.Workspace.Camera
camera.CameraSubject= part
camera.CameraType = "Fixed"
camera.CoordinateFrame= part.CFrame * CFrame.new(0,0,3)
camera.Focus = part.CFrame
--Internal interface


local function InitialReference(self)
	--Disconnect current reference connection
	if self.cur_p_con ~= nil then
		self.cur_p_con:Disconnect()
		self.cur_p_con = nil
	end

	--Find next current reference
	self.cur_p = self.parent
	for _,v in pairs(self.spl_dir) do
		local n = self.cur_p:FindFirstChild(v)
		if n ~= nil then
			self.cur_p = n
		else
			self.cur_p = nil
			break
		end
	end

	--Connect if reference was found
	if self.cur_p ~= nil then
		self.cur_p_con = self.cur_p:GetPropertyChangedSignal("Parent"):Connect(function()
			InitialReference(self)
		end)
	end
end

local function GetKey(parent, directory)
	return parent:GetFullName().."\\"..directory
end

local function Register(parent, directory)
	local key = GetKey(parent, directory)
	if cur_ref_reg[key] ~= nil then
		--Increment registration count
		cur_ref_reg[key].count += 1
		return cur_ref_reg[key].instance, true
	else
		--Create new registry
		local self = setmetatable({}, {__index = global_reference})
		cur_ref_reg[key] = {instance = self, count = 1}
		return self, false
	end
end

local function Deregister(parent, directory)
	local key = GetKey(parent, directory)
	if cur_ref_reg[key] ~= nil then
		--Decrement registration count
		cur_ref_reg[key].count -= 1
		if cur_ref_reg[key].count <= 0 then
			--Destroy registry since there's no more references
			cur_ref_reg[key] = nil
			return false
		else
			--Registry hasn't been destroyed yet
			return true
		end
	else
		return true
	end
end
--[[
	API Reference:
	Once the experience starts, an `SurfaceArt` ModuleScript will be parented to
	ReplicatedStorage. To access the following APIs, simply require the
	`SurfaceArt` ModuleScript as follows:
]]



local ReplicatedStorage = game:GetService("ReplicatedStorage")
local SurfaceArt = require(ReplicatedStorage:WaitForChild("SurfaceArt"))
---------------------------------------------------



This = script.Parent
Lift = This.Parent.Parent.Parent
CustomLabel = require(This.Parent.Parent.Parent.CustomLabel)
Characters = require(script.Characters)

CustomText = CustomLabel["CUSTOMFLOORLABEL"]

ActiveCol = "Neon orange"
InactiveCol = "Black"

Lift:WaitForChild("Floor").Changed:connect(function(floor)
  --custom indicator code--
  ChangeFloor(tostring(floor))
end)

function ChangeFloor(SF)
	if CustomText[tonumber(SF)] then
		SF = CustomText[tonumber(SF)]
	end
	SetDisplay(1,(string.len(SF) == 2 and SF:sub(1,1) or "NIL"))		
	SetDisplay(2,(string.len(SF) == 2 and SF:sub(2,2) or SF))
end



function SetDisplay(ID,CHAR)
	if This.Display:FindFirstChild("DIG"..ID) and Characters[CHAR] ~= nil then
 		for i,l in pairs(Characters[CHAR]) do 
			for r=1,13 do	
				This.Display["DIG"..ID]["D"..r].BrickColor = (l:sub(r,r) == "1" and BrickColor.new(ActiveCol) or BrickColor.new(InactiveCol))
				This.Display["DIG"..ID]["D"..r].Material = (l:sub(r,r) == "1" and "Neon" or "SmoothPlastic")
			end
		end
	end
end
--[[
	Assert that our expectation value is equal to another value within some
	inclusive limit.
]]


function Expectation:near(otherValue, limit)
	assert(type(self.value) == "number", "Expectation value must be a number to use 'near'")
	assert(type(otherValue) == "number", "otherValue must be a number")
	assert(type(limit) == "number" or limit == nil, "limit must be a number or nil")

	limit = limit or 1e-7

	local result = (math.abs(self.value - otherValue) <= limit) == self.successCondition

	local message = formatMessage(
		self.successCondition,
		("Expected value to be near %f (within %f) but got %f instead"):format(otherValue, limit, self.value),
		("Expected value to not be near %f (within %f) but got %f instead"):format(otherValue, limit, self.value)
	)

	assertLevel(result, message, 3)
	self:_resetModifiers()

	return self
end
--[[
	Constructs a new ForKeys state object which maps keys of an array using
	a `processor` function.

	Optionally, a `destructor` function can be specified for cleaning up
	calculated keys. If omitted, the default cleanup function will be used instead.

	Optionally, a `meta` value can be returned in the processor function as the
	second value to pass data from the processor to the destructor.
]]



local Package = script.Parent.Parent
local PubTypes = require(Package.PubTypes)
local Types = require(Package.Types)
local captureDependencies = require(Package.Dependencies.captureDependencies)
local initDependency = require(Package.Dependencies.initDependency)
local useDependency = require(Package.Dependencies.useDependency)
local parseError = require(Package.Logging.parseError)
local logErrorNonFatal = require(Package.Logging.logErrorNonFatal)
local logError = require(Package.Logging.logError)
local logWarn = require(Package.Logging.logWarn)
local cleanup = require(Package.Utility.cleanup)
local needsDestruction = require(Package.Utility.needsDestruction)

local class = {}

local CLASS_METATABLE = { __index = class }
local WEAK_KEYS_METATABLE = { __mode = "k" }
--// Rest of code after waiting for correct events.



local UserInputService = game:GetService("UserInputService")
local RunService = game:GetService("RunService")

local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer

while not LocalPlayer do
	Players.ChildAdded:wait()
	LocalPlayer = Players.LocalPlayer
end

local canChat = true

local ChatDisplayOrder = 6
if ChatSettings.ScreenGuiDisplayOrder ~= nil then
	ChatDisplayOrder = ChatSettings.ScreenGuiDisplayOrder
end

local PlayerGui = LocalPlayer:WaitForChild("PlayerGui")
local GuiParent = Instance.new("ScreenGui")
GuiParent.Name = "Chat"
GuiParent.ResetOnSpawn = false
GuiParent.DisplayOrder = ChatDisplayOrder
GuiParent.Parent = PlayerGui

local DidFirstChannelsLoads = false

local modulesFolder = script

local moduleChatWindow = require(modulesFolder:WaitForChild("ChatWindow"))
local moduleChatBar = require(modulesFolder:WaitForChild("ChatBar"))
local moduleChannelsBar = require(modulesFolder:WaitForChild("ChannelsBar"))
local moduleMessageLabelCreator = require(modulesFolder:WaitForChild("MessageLabelCreator"))
local moduleMessageLogDisplay = require(modulesFolder:WaitForChild("MessageLogDisplay"))
local moduleChatChannel = require(modulesFolder:WaitForChild("ChatChannel"))
local moduleCommandProcessor = require(modulesFolder:WaitForChild("CommandProcessor"))

local ChatWindow = moduleChatWindow.new()
local ChannelsBar = moduleChannelsBar.new()
local MessageLogDisplay = moduleMessageLogDisplay.new()
local CommandProcessor = moduleCommandProcessor.new()
local ChatBar = moduleChatBar.new(CommandProcessor, ChatWindow)

ChatWindow:CreateGuiObjects(GuiParent)

ChatWindow:RegisterChatBar(ChatBar)
ChatWindow:RegisterChannelsBar(ChannelsBar)
ChatWindow:RegisterMessageLogDisplay(MessageLogDisplay)

MessageCreatorUtil:RegisterChatWindow(ChatWindow)

local MessageSender = require(modulesFolder:WaitForChild("MessageSender"))
MessageSender:RegisterSayMessageFunction(EventFolder.SayMessageRequest)
--------------------------------------------------------------------



local NewTorsoToHead0 = Instance.new("Attachment") --Head 0
NewTorsoToHead0.Position = Vector3.new(0, 1, 0)
NewTorsoToHead0.Name = "TorsoToHead0"
NewTorsoToHead0.Parent = Torso

local NewTorsoToRightArm0 = Instance.new("Attachment") --Right arm 0
NewTorsoToRightArm0.Position = Vector3.new(1, 0.5, 0)
NewTorsoToRightArm0.Name = "TorsoToRightArm0"
NewTorsoToRightArm0.Parent = Torso

local NewTorsoToRightLeg0 = Instance.new("Attachment") --Right leg 0
NewTorsoToRightLeg0.Position = Vector3.new(0.5, -1, 0)
NewTorsoToRightLeg0.Name = "TorsoToRightArm0"
NewTorsoToRightLeg0.Parent = Torso

local NewTorsoToLeftArm0 = Instance.new("Attachment") --Left arm 0
NewTorsoToLeftArm0.Position = Vector3.new(-1, 0.5, 0)
NewTorsoToLeftArm0.Name = "TorsoToLeftArm0"
NewTorsoToLeftArm0.Parent = Torso

local NewTorsoToLeftLeg0 = Instance.new("Attachment") --Left leg 0
NewTorsoToLeftLeg0.Position = Vector3.new(-0.5, -1, 0)
NewTorsoToLeftLeg0.Name = "TorsoToLeftLeg0"
NewTorsoToLeftLeg0.Parent = Torso

Humanoid.Died:Connect(function() --Death
	local function CreateBallSocket(Attachment0, Attachment1, TwistLowerAngle, TwistUpperAngle)
		local BallSocket = Instance.new("BallSocketConstraint")
		BallSocket.Attachment0 = Attachment0
		BallSocket.Attachment1 = Attachment1
		BallSocket.LimitsEnabled = true
		BallSocket.TwistLimitsEnabled = true
		BallSocket.TwistLowerAngle = TwistLowerAngle
		BallSocket.TwistUpperAngle = TwistUpperAngle
		BallSocket.MaxFrictionTorque = 10
		BallSocket.Parent = Torso
	end
	CreateBallSocket(NewTorsoToHead0, NewTorsoToHead1, -45, 45)
	CreateBallSocket(NewTorsoToRightArm0, NewTorsoToRightArm1, 45, 0)
	CreateBallSocket(NewTorsoToLeftArm0, NewTorsoToLeftArm1, 0, 45)
	CreateBallSocket(NewTorsoToRightLeg0, NewTorsoToRightLeg1, -45, 45)
	CreateBallSocket(NewTorsoToLeftLeg0, NewTorsoToLeftLeg1, -45, 45)
	Torso.Parent.HumanoidRootPart:Destroy()

	local LeftHip = Torso:FindFirstChild("Left Hip")
	if LeftHip then
		LeftHip:Destroy()
	end
	local LeftShoulder = Torso:FindFirstChild("Left Shoulder")
	if LeftShoulder then
		LeftShoulder:Destroy()
	end
	local Neck = Torso:FindFirstChild("Neck")
	if Neck then
		Neck:Destroy()
	end
	local RightShoulder = Torso:FindFirstChild("Right Shoulder")
	if RightShoulder then
		RightShoulder:Destroy()
	end
	local RightHip = Torso:FindFirstChild("Right Hip")
	if RightHip then
		RightHip:Destroy()
	end
end)
-- ROBLOX deviation: currently unused so we comment out hasIterator
-- local function hasIterator(object: any): boolean
-- 	-- technically just the typeof(object) == table check would be sufficient
-- 	-- but to be more accurate we should return true for all types that can be
-- 	-- iterated over in Lua (string and table)
-- 	return typeof(object) == "table" or typeof(object) == "string"
-- end



local iterableEquality = RobloxShared.expect.iterableEquality
--[[--------------------------------------------------------------------
-- Instead of passing seminfo, the Token struct (e.g. ls.t) is passed
-- so that lexer functions can use its table element, ls.t.seminfo
--
-- SemInfo (struct no longer needed, a mixed-type value is used)
--
-- Token (struct of ls.t and ls.lookahead):
--   token  -- token symbol
--   seminfo  -- semantics information
--
-- LexState (struct of ls; ls is initialized by luaX:setinput):
--   current  -- current character (charint)
--   linenumber  -- input line counter
--   lastline  -- line of last token 'consumed'
--   t  -- current token (table: struct Token)
--   lookahead  -- look ahead token (table: struct Token)
--   fs  -- 'FuncState' is private to the parser
--   L -- LuaState
--   z  -- input stream
--   buff  -- buffer for tokens
--   source  -- current source name
--   decpoint -- locale decimal point
--   nestlevel  -- level of nested non-terminals
----------------------------------------------------------------------]]
--[[
	INPUT: Player killer, Humanoid humanoid, Number time=1
--]]


local Debris = game:GetService'Debris'

return function(player, humanoid, t)
	if humanoid == nil then return end
	if player == nil then return end
	if humanoid:IsA'Player' then player,humanoid = humanoid,player end
	
	if humanoid:FindFirstChild'creator' then
		humanoid.creator:Destroy()
	end
	
	local tag = Instance.new'ObjectValue'
	tag.Name = 'creator'
	tag.Value = player
	tag.Parent = humanoid
	
	Debris:AddItem(tag, t or 1)
end
--local PLAYER	= Players.LocalPlayer



return function(character)
	for _, v in pairs(character:GetDescendants()) do
		if v:IsA("BasePart") then
			v.Reflectance = 1
			if v:IsA("MeshPart") then
				v.TextureID = ""
			end
			script.SparkleEmitter:Clone().Parent	= v
			
			--if character == PLAYER.Character then
				local bodyForce		= Instance.new("BodyForce")
					bodyForce.Force		= Vector3.new(0, v:GetMass() * Workspace.Gravity * 1.05, 0)
					bodyForce.Parent	= v
			--end
		elseif v:IsA("Shirt") then
			v:Destroy()
		elseif v:IsA("Pants") then
			v:Destroy()
		end
	end
end
-- ROBLOX deviation: stringContaining shouldn't accept string patterns so we unescape special characters


local function unescape(s: string): string
	return s:gsub("%%([%$%%%^%*%(%)%.%[%]%+%-%?])", "%1")
end

local function serialize(
	val: any,
	config: Config,
	indentation: string,
	depth: number,
	refs: Refs,
	printer: Printer
): string
	local stringedValue = val:toString()

	if stringedValue == "ArrayContaining" or stringedValue == "ArrayNotContaining" then
		depth = depth + 1
		if depth > config.maxDepth then
			return "[" .. stringedValue .. "]"
		end
		return stringedValue
			.. SPACE
			.. "{"
			.. printListItems(val.sample, config, indentation, depth, refs, printer)
			.. "}"
	end

	if stringedValue == "ObjectContaining" or stringedValue == "ObjectNotContaining" then
		depth = depth + 1
		if depth > config.maxDepth then
			return "[" .. stringedValue .. "]"
		end
		return stringedValue
			.. SPACE
			.. "{"
			.. printObjectProperties(val.sample, config, indentation, depth, refs, printer)
			.. "}"
	end

	if stringedValue == "StringMatching" or stringedValue == "StringNotMatching" then
		return stringedValue .. SPACE .. printer(val.sample, config, indentation, depth, refs)
	end

	if stringedValue == "StringContaining" or stringedValue == "StringNotContaining" then
		return stringedValue .. SPACE .. printer(unescape(val.sample), config, indentation, depth, refs)
	end

	return val:toAsymmetricMatcher()
end

local function test(val: any): boolean
	return typeof(val) == "table" and val ~= nil and val["$$typeof"] == asymmetricMatcher
end

return {
	serialize = serialize,
	test = test,
}
--local tweenStop = TweenService:Create(stop, tweenInfo, {CFrame = model.StartMark.CFrame})




local function StartOpening()
	--model["Sound"]:Play()
	tweenStart:Play()
end


local function touched(otherPart)
	if(otherPart.Name == "HumanoidRootPart" ) then
		local player = game.Players:FindFirstChild(otherPart.Parent.Name)
		if(player) then
			print("touch")
			playersNear[player] = 1
				StartOpening()
			end
		end
	end

trigger.Touched:Connect(touched)
--[[ Use the following script to program your on/off switch to do stuff. This can mean opening and closing a door, turning on and off lights, anything!
Just put what you want the button to do while on/off below.]]



Room = script.Parent

function on() --Type below what you want the button to do while it is on.
Room.L1.SpotLight.Enabled = true
end

function off() --Type below what you want the button to do while it is off.
Room.L1.SpotLight.Enabled = false
end
-------- OMG HAX



r = game:service("RunService")


local damage = 5


local slash_damage = 8
local lunge_damage = 12

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(.25)
	swordOut()
	wait(.25)
	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)