Roblox/luau_corpus huggingface dataset:
-----------------
--| Variables |--
-----------------

local DebrisService = Game:GetService('Debris')
local PlayersService = Game:GetService('Players')

local Rocket = script.Parent

local CreatorTag = WaitForChild(Rocket, 'creator')
local SwooshSound = WaitForChild(Rocket, 'Swoosh')
--// Handling Settings		
	Firerate = 60 / 450; -- 60 = 1 Minute, 450 = Rounds per that 60 seconds. DO NOT TOUCH THE 60!
	
	FireMode = 1; -- 1 = Semi, 2 = Auto, 3 = Burst, 4 = Bolt Action, 5 = Shot, 6 = Explosive
--// J key, Stages
mouse.KeyDown:connect(function(key)
	if key=="j" then 
		veh.Lightbar.middle.Beep:Play()
		veh.Lightbar.Remotes.StageEvent:FireServer(true)
	end
end)
--- Sends an event message to a player
function Command:SendEvent(player, event, ...)
	assert(typeof(player) == "Instance", "Argument #1 must be a Player")
	assert(player:IsA("Player"), "Argument #1 must be a Player")
	assert(type(event) == "string", "Argument #2 must be a string")

	if IsServer then
		self.Dispatcher.Cmdr.RemoteEvent:FireClient(player, event, ...)
	elseif self.Dispatcher.Cmdr.Events[event] then
		assert(player == Players.LocalPlayer, "Event messages can only be sent to the local player on the client.")
		self.Dispatcher.Cmdr.Events[event](...)
	end
end
-----------------------------------------------------------------------------------------------

script.Parent:WaitForChild("Gear")
script.Parent:WaitForChild("Speed")

local player=game.Players.LocalPlayer
local mouse=player:GetMouse()

local car = script.Parent.Parent.Car.Value
car.DriveSeat.HeadsUpDisplay = false

local _Tune = require(car["A-Chassis Tune"])

local _pRPM = _Tune.PeakRPM
local _lRPM = _Tune.Redline

local currentUnits = 1
local revEnd = math.ceil(_lRPM/1000)
--Jamie




debounce = true
function onTouched(hit)


		if (hit.Parent:findFirstChild("Humanoid") ~= nil and debounce == true) then
			if game.Players:getPlayerFromCharacter(hit.Parent) then 
				
        script.Parent.Refill:Play()
        hit.Parent.Saude.Kit.Parent.Kit.Aspirina.Value = hit.Parent.Saude.Kit.Parent.Kit.Aspirina.MaxValue --Painkillers
        hit.Parent.Saude.Kit.Parent.Kit.Bandagem.Value = hit.Parent.Saude.Kit.Parent.Kit.Bandagem.MaxValue --Field Dressing/Bandages
        hit.Parent.Saude.Kit.Parent.Kit.Energetico.Value = hit.Parent.Saude.Kit.Parent.Kit.Energetico.MaxValue --Energy Drink
        hit.Parent.Saude.Kit.Parent.Kit.Epinefrina.Value = hit.Parent.Saude.Kit.Parent.Kit.Epinefrina.MaxValue --Epinephrine
        hit.Parent.Saude.Kit.Parent.Kit.Morfina.Value = hit.Parent.Saude.Kit.Parent.Kit.Morfina.MaxValue --Morphine
        hit.Parent.Saude.Kit.Parent.Kit.SacoDeSangue.Value = 20 --Blood Bag
        hit.Parent.Saude.Kit.Parent.Kit.Splint.Value = hit.Parent.Saude.Kit.Parent.Kit.Splint.MaxValue --Splint (fixes injured status)
		hit.Parent.Saude.Kit.Parent.Kit.skit.Value = 26
        hit.Parent.Saude.Kit.Parent.Kit.bvm.Value = 1
        hit.Parent.Saude.Kit.Parent.Kit.etube.Value =  2
		hit.Parent.Saude.Kit.Parent.Kit.nrb.Value = 2
		hit.Parent.Saude.Kit.Parent.Kit.npa.Value = 2

        hit.Parent.Saude.Kit.Parent.Kit.Tourniquet.Value =  5
     
        hit.Parent.Saude.Kit.Parent.Kit.defib.Value =  1
        hit.Parent.Saude.Kit.Parent.Kit.o2.Value =  2
        hit.Parent.Saude.Kit.Parent.Kit.prolene.Value =  15
     
        debounce = false
        print("Refill Cooling Down")
        wait(5)
        debounce = true
				print("Refill Cooldown Over")
			
			end
		end
		
    end

script.Parent.Touched:connect(onTouched)
-- ROBLOX deviation: helper function moved to RobloxShared and no longer needed here
-- local hasPropertyInObject = RobloxShared.expect.hasPropertyInObject

local function getPath(object: { [string]: any }, propertyPath): GetPath
	if not Array.isArray(propertyPath) then
		propertyPath = pathAsArray(propertyPath)
	end

	if #propertyPath > 0 then
		local lastProp = #propertyPath == 1
		local prop = propertyPath[1]

		-- We need this code block in Lua since attempting object[prop] on a non-table
		-- will throw an error
		local ok, res = pcall(function()
			return object[prop]
		end)

		local newObject = res

		if not ok or (not lastProp and newObject == nil) then
			-- This is not the last prop in the chain. If we keep recursing
			-- we will get a nil access error. At this point we know that the
			-- chain has broken and we can return right away.
			return {
				hasEndProp = false,
				lastTraversedObject = object,
				traversedPath = {},
			}
		end

		local result = getPath(newObject, Array.slice(propertyPath, 2))

		if result.lastTraversedObject == nil then
			result.lastTraversedObject = object
		end

		table.insert(result.traversedPath, 1, prop)

		if lastProp then
			result.hasEndProp = newObject ~= nil

			if not result.hasEndProp then
				Array.shift(result.traversedPath)
			end
		end

		return result
	end

	return {
		lastTraversedObject = nil,
		traversedPath = {},
		value = object,
	}
end
--Function For Making New Ray Bricks
function makeRay(cframe, size)
	local p						= Instance.new("Part")
	p.Name						= "RayPart"
	p.BrickColor				= BrickColor.new("Bright red")
	p.Material                  = "Neon"
	p.Transparency				= 0.5
	p.Anchored					= true
	p.CanCollide				= false
	p.TopSurface				= Enum.SurfaceType.Smooth
	p.BottomSurface				= Enum.SurfaceType.Smooth
	p.formFactor				= Enum.FormFactor.Custom
	p.CFrame					= cframe
	p.Size						= size
	p.Parent					= m
	ignoreList[#ignoreList+1]	= p
end



round					= Instance.new("Part")
round.Name				= "RayPart"
round.Material          = "Neon"
round.Transparency		= 0.5
round.Anchored			= true
round.CanCollide		= false
round.TopSurface		= Enum.SurfaceType.Smooth
round.BottomSurface		= Enum.SurfaceType.Smooth
round.formFactor		= Enum.FormFactor.Custom
round.BrickColor		= BrickColor.new("Bright red")
yOffset					= -0.2
-- Decompiled with the Synapse X Luau decompiler.

local v1 = {
	Name = "bind", 
	Aliases = {}, 
	Description = "Binds a command string to a key or mouse input.", 
	Group = "DefaultUtil", 
	Args = { {
			Type = "userInput ! bindableResource @ player", 
			Name = "Input", 
			Description = "The key or input type you'd like to bind the command to."
		}, {
			Type = "command", 
			Name = "Command", 
			Description = "The command you want to run on this input"
		}, {
			Type = "string", 
			Name = "Arguments", 
			Description = "The arguments for the command", 
			Default = ""
		} }
};
local l__UserInputService__1 = game:GetService("UserInputService");
function v1.ClientRun(p1, p2, p3, p4)
	local v2 = p1:GetStore("CMDR_Binds");
	p3 = p3 .. " " .. p4;
	if v2[p2] then
		v2[p2]:Disconnect();
	end;
	local l__Name__3 = p1:GetArgument(1).Type.Name;
	if l__Name__3 == "userInput" then
		v2[p2] = l__UserInputService__1.InputBegan:Connect(function(p5, p6)
			if p6 then
				return;
			end;
			if p5.UserInputType == p2 or p5.KeyCode == p2 then
				p1:Reply(p1.Dispatcher:EvaluateAndRun(p1.Cmdr.Util.RunEmbeddedCommands(p1.Dispatcher, p3)));
			end;
		end);
	else
		if l__Name__3 == "bindableResource" then
			return "Unimplemented...";
		end;
		if l__Name__3 == "player" then
			v2[p2] = p2.Chatted:Connect(function(p7)
				local v4 = p1.Cmdr.Util.RunEmbeddedCommands(p1.Dispatcher, p1.Cmdr.Util.SubstituteArgs(p3, { p7 }));
				p1:Reply(("%s $ %s : %s"):format(p2.Name, v4, p1.Dispatcher:EvaluateAndRun(v4)), Color3.fromRGB(244, 92, 66));
			end);
		end;
	end;
	return "Bound command to input.";
end;
return v1;
-- Load tool completely before loading cached libraries
local Tool = script.Parent;
local Indicator = Tool:WaitForChild 'Loaded';
while not Indicator.Value do
	Indicator.Changed:Wait();
end;
-- load it to the humanoid; get AnimationTrack
currentAnimTrack = humanoid:LoadAnimation(anim)
-- LocalScript

local numValue = Player.Salario.Diamante -- substitua "NumValue" pelo nome da sua NumberValue
local textLabel = script.Parent -- substitua "TextLabel" pelo nome do seu TextLabel
--The following code will print the Name and ClassName of every child of workspace
--(You can run it in command bar to test the module)
--[[
  getAllChildren = require(game:FindFirstChild("GetAllChildren Module",true)) 
  for _,v in pairs(getAllChildren(workspace)) do
    print(string.rep("-",15).."\nName: "..v.Name.."\nClassName: "..v.ClassName)
  end
]]

GetAllChildren = function(obj)
	local Children = {}
	function vGetChildren(trg)
		for _,v in pairs(trg:GetChildren()) do
			table.insert(Children, v)
			vGetChildren(v)
		end
	end
	vGetChildren(obj)
	return Children
end

return GetAllChildren
--[[Wheel Alignment]]
	--[Don't physically apply alignment to wheels]
	--[Values are in degrees]
	Tune.FCamber		= 0
	Tune.RCamber		= 0
	Tune.FToe			= 0
	Tune.RToe			= 0
--[[
	Gathers all of the errors reported by tests and puts them at the top level
	of the TestResults object.
]]
function TestSession:gatherErrors()
	local results = self.results

	results.errors = {}

	results:visitAllNodes(function(node)
		if #node.errors > 0 then
			for _, message in ipairs(node.errors) do
				table.insert(results.errors, message)
			end
		end
	end)
end
--[[ The Module ]]--
local BaseCamera = require(script.Parent:WaitForChild("BaseCamera"))
local VRBaseCamera = setmetatable({}, BaseCamera)
VRBaseCamera.__index = VRBaseCamera

local FFlagUserVRVignetteToggle do
	local success, result = pcall(function()
		return UserSettings():IsUserFeatureEnabled("UserVRVignetteToggle")
	end)
	FFlagUserVRVignetteToggle = success and result
end

function VRBaseCamera.new()
	local self = setmetatable(BaseCamera.new(), VRBaseCamera)

	-- distance is different in VR
	self.defaultDistance = VR_ZOOM
	self.defaultSubjectDistance = math.clamp(self.defaultDistance, player.CameraMinZoomDistance, player.CameraMaxZoomDistance)
	self.currentSubjectDistance = math.clamp(self.defaultDistance, player.CameraMinZoomDistance, player.CameraMaxZoomDistance)

	-- VR screen effect
	self.VRFadeResetTimer = 0
	self.VREdgeBlurTimer = 0

	-- initialize vr specific variables
	self.gamepadResetConnection = nil
	self.needsReset = true

	return self
end

function VRBaseCamera:GetModuleName()
	return "VRBaseCamera"
end

function VRBaseCamera:GamepadZoomPress()
	local dist = self:GetCameraToSubjectDistance()

	if dist > VR_ZOOM / 2 then
		self:SetCameraToSubjectDistance(0)
		self.currentSubjectDistance = 0
	else
		self:SetCameraToSubjectDistance(VR_ZOOM)
		self.currentSubjectDistance = VR_ZOOM
	end

	self:GamepadReset()
	self:ResetZoom()
end

function VRBaseCamera:GamepadReset()
	self.needsReset = true
end

function VRBaseCamera:ResetZoom()
	ZoomController.SetZoomParameters(self.currentSubjectDistance, 0)
	ZoomController.ReleaseSpring()
end

function VRBaseCamera:OnEnable(enable: boolean)
	if enable then
		self.gamepadResetConnection = CameraInput.gamepadReset:Connect(function()
			self:GamepadReset()
		end)
	else
		-- make sure zoom is reset when switching to another camera
		if self.inFirstPerson then
			self:GamepadZoomPress()
		end

		if self.gamepadResetConnection then
			self.gamepadResetConnection:Disconnect()
			self.gamepadResetConnection = nil
		end

		-- reset VR effects
		self.VREdgeBlurTimer = 0
		self:UpdateEdgeBlur(player, 1)
		local VRFade = Lighting:FindFirstChild("VRFade")
		if VRFade then
			VRFade.Brightness = 0
		end
	end
end

function VRBaseCamera:UpdateDefaultSubjectDistance()
	self.defaultSubjectDistance = math.clamp(VR_ZOOM, player.CameraMinZoomDistance, player.CameraMaxZoomDistance)
end
-- ROBLOX deviation: the prefix is constant because the console prints the stack
-- frames the same way on every platform.
local prefix = "    in "
--print(me.Name)
DAMAGE=me.Parent.Config.Damage.Value + me.Parent.Config.DamageAdd.Value * plr.VAR.turStr.Value
debounce=false

local human	= me.Parent.Humanoid

local function Hit(hit)
	local target= hit.Parent.Name
	local bullet = me.Parent
	-- print("Target=",target)
-- set and keep every body part Transparency to its real transparency
for childIndex, child in pairs(character:GetChildren()) do
    if child:IsA("BasePart") and child.Name ~= "Head" then
        
        child:GetPropertyChangedSignal("LocalTransparencyModifier"):Connect(function()
            child.LocalTransparencyModifier = child.Transparency
        end)
        
        child.LocalTransparencyModifier = child.Transparency
        
    end
end
--/////////////////////////////////////////////////////////--

local dZIndex 	 = 2
local dScrollBar = 4
local dBackground 	= Color3.new(31/255, 31/255, 31/255)
local dSecondaryBackground = dBackground:lerp(Color3.new(1,1,1), 0.1);
local dTransparency = 0
local dPixelSize 	= 0
local dBorder 		= Color3.new(27/255,42/255,53/255)
local dPosition 	= UDim2.new(0,5,0,5)
local dCanvasSize 	= UDim2.new(0, 0, 0, 0)
local dScrollImage 	= "http://roblox.com/asset?id=158348114"
local dTextColor = Color3.new(1,1,1)
local dSize 	 = UDim2.new(1,-10,1,-10)
local dFont 	 = "SourceSans"
local dTextSize  = 16
local dPlaceholderColor = Color3.fromRGB(178, 178, 178)
local MouseIcons = {
	Horizontal = "rbxassetid://1243146213";
	Vertical = "rbxassetid://1243145985";
	LeftCorner = "rbxassetid://1243145459";
	RightCorner = "rbxassetid://1243145350";
	TopRight = "rbxassetid://1243145459";
	TopLeft = "rbxassetid://1243145350";
}
--[[
local ClickSelectOption = SettingsPanel:WaitForChild("ClickSelect"):WaitForChild("Change")
local SelectionBoxOption = SettingsPanel:WaitForChild("SelectionBox"):WaitForChild("Change")
local ClearPropsOption = SettingsPanel:WaitForChild("ClearProperties"):WaitForChild("Change")
local SelectUngroupedOption = SettingsPanel:WaitForChild("SelectUngrouped"):WaitForChild("Change")
--]]

local SelectionChanged = ExplorerPanel:WaitForChild("SelectionChanged")
local GetSelection = ExplorerPanel:WaitForChild("GetSelection")
local SetSelection = ExplorerPanel:WaitForChild("SetSelection")

local Player = game:GetService("Players").LocalPlayer
local Mouse = Player:GetMouse()

local CurrentWindow = "Nothing c:"
local Windows = {
	Explorer = {
		ExplorerPanel,
		PropertiesFrame
	},
	Settings = {SettingsPanel},
	SaveMap = {SaveMapWindow},
	Remotes = {RemoteDebugWindow}
}

for i,v in pairs(Player.PlayerGui:GetChildren()) do
	if v ~= script.Parent and v.Name == "Dex_Explorer" then
		v:Destroy()
	end
end

function switchWindows(wName,over)
	if CurrentWindow == wName and not over then return end
	
	local count = 0
	
	for i,v in pairs(Windows) do
		count = 0
		if i ~= wName then
			for _,c in pairs(v) do c:TweenPosition(UDim2.new(1, 30, count * 0.5, count * 36), "Out", "Quad", 0.5, true) count = count + 1 end
		end
	end
	
	count = 0
	
	if Windows[wName] then
		for _,c in pairs(Windows[wName]) do c:TweenPosition(UDim2.new(1, -300, count * 0.5, count * 36), "Out", "Quad", 0.5, true) count = count + 1 end
	end
	
	if wName ~= "Nothing c:" then
		CurrentWindow = wName
		for i,v in pairs(SlideFrame:GetChildren()) do
			v.BackgroundTransparency = 1
			v.Icon.ImageColor3 = Color3.new(70/255, 70/255, 70/255)
		end
		if SlideFrame:FindFirstChild(wName) then
			SlideFrame[wName].BackgroundTransparency = 0.5
			SlideFrame[wName].Icon.ImageColor3 = Color3.new(0,0,0)
		end
	end
end

function toggleDex(on)
	if on then
		SideMenu:TweenPosition(UDim2.new(1, -330, 0, 0), "Out", "Quad", 0.5, true)
		OpenToggleButton:TweenPosition(UDim2.new(1,0,0,0), "Out", "Quad", 0.5, true)
		switchWindows(CurrentWindow,true)
	else
		SideMenu:TweenPosition(UDim2.new(1, 0, 0, 0), "Out", "Quad", 0.5, true)
		--OpenToggleButton:TweenPosition(UDim2.new(1,-30,0,0), "Out", "Quad", 0.5, true)
		switchWindows("Nothing c:")
		wait(0.6)
		script.Parent:Destroy()
	end
end

local Settings = {
	ClickSelect = false,
	SelBox = false,
	ClearProps = false,
	SelectUngrouped = true,
	SaveInstanceScripts = true
}

function ReturnSetting(set)
	if set == "ClearProps" then
		return Settings.ClearProps
	elseif set == "SelectUngrouped" then
		return Settings.SelectUngrouped
	end
end

OpenToggleButton.MouseButton1Up:connect(function()
	toggleDex(true)
end)

OpenScriptEditorButton.MouseButton1Up:connect(function()
	if OpenScriptEditorButton.Active then
		--ScriptEditor.Visible = true
	end
end)

CloseToggleButton.MouseButton1Up:connect(function()
	if CloseToggleButton.Active then
		toggleDex(false)
	end
end)
--[[ Test
function Tween(Object, Properties, Value, Time, Style, Direction)
	Style = Style or Enum.EasingStyle.Quad
	Direction = Direction or Enum.EasingDirection.Out
	Time = Time or 0.5
	local propertyGoals = {}
	local Table = (type(Value) == "table" and true) or false
	for i,Property in pairs(Properties) do
		propertyGoals[Property] = Table and Value[i] or Value
	end
	local tweenInfo = TweenInfo.new(Time, Style, Direction)
	local tween = game:GetService("TweenService"):Create(Object,tweenInfo,propertyGoals)
	tween:Play()
end
game.StarterGui.CoreGUI.BadgeScaling.Size = UDim2.new(0,50,0,50)
game.StarterGui.CoreGUI.BadgeScaling.ImageTransparency = 0
game.StarterGui.CoreGUI.BadgeScaling.Visible = true
Tween(game.StarterGui.CoreGUI.BadgeScaling, {"Size", "ImageTransparency"}, {UDim2.new(0,250,0,250), 1}, 1)
]]

return module
--CHANGE THE NAME, COPY ALL BELOW, AND PAST INTO COMMAND BAR

local TycoonName = "INSERT TYCOON NAME HERE"

if game.Workspace:FindFirstChild(TycoonName) then
	local s = nil
	local bTycoon = game.Workspace:FindFirstChild(TycoonName)
	local zTycoon = game.Workspace:FindFirstChild("Zednov's Tycoon Kit")
	local new_Collector = zTycoon['READ ME'].Script:Clone()
	local Gate = zTycoon.Tycoons:GetChildren()[1].Entrance['Touch to claim!'].GateControl:Clone()
	if zTycoon then
		for i,v in pairs(zTycoon.Tycoons:GetChildren()) do --Wipe current tycoon 'demo'
			if v then
				s = v.PurchaseHandler:Clone()
				v:Destroy()
			end
		end
		-- Now make it compatiable
		if s ~= nil then
			for i,v in pairs(bTycoon.Tycoons:GetChildren()) do
				local New_Tycoon = v:Clone()
				New_Tycoon:FindFirstChild('PurchaseHandler'):Destroy()
				s:Clone().Parent = New_Tycoon
				local Team_C = Instance.new('BrickColorValue',New_Tycoon)
				Team_C.Value = BrickColor.new(tostring(v.Name))
				Team_C.Name = "TeamColor"
				New_Tycoon.Name = v.TeamName.Value
				New_Tycoon.Cash.Name = "CurrencyToCollect"
				New_Tycoon.Parent = zTycoon.Tycoons
				New_Tycoon.TeamName:Destroy()
				v:Destroy()
				New_Tycoon.Essentials:FindFirstChild('Cash to collect: $0').NameUpdater:Destroy()
				local n = new_Collector:Clone()
				n.Parent = New_Tycoon.Essentials:FindFirstChild('Cash to collect: $0')
				n.Disabled = false
				New_Tycoon.Gate['Touch to claim ownership!'].GateControl:Destroy()
				local g = Gate:Clone()
				g.Parent = New_Tycoon.Gate['Touch to claim ownership!']
			end
		else
			error("Please don't tamper with script names or this won't work!")
		end
	else
		error("Please don't change the name of our tycoon kit or it won't work!")
	end
	bTycoon:Destroy()
	Gate:Destroy()
	new_Collector:Destroy()
	print('Transfer complete! :)')
else
	error("Check if you spelt the kit's name wrong!")
end
-- Returns whether the inputted status passes the TextFilter, otherwise also returns an error
function UpdateProfileRemoteFunction.OnServerInvoke(playerFiring, playerSelected, statusText)
	local filteredStatus = filterText(statusText, playerSelected.UserId, playerFiring.UserId)
	if filteredStatus == statusText then
		playerFiring:SetAttribute("status", filteredStatus)
	end
	return { success = filteredStatus == statusText }
end
--// Use the power of the Dark Flames and hit as many people as you can to perform a chain attack!

local Properties = {
	DamageMode = "Normal", --What mode to reference the damage tables listed below
	
	Special = true,--The internal logical indicator to determine if we can use our special.
	
	Special_Reload = 10, --The Cooldown time until the ability is ready to be used.
	
	SpeedCap = 50, --This is the wielder's walkspeed when equipped

	DamageValues = {
		Normal = {
			Min = 2,
			Max = 5,
		},
		
		Lunge = {
			Min = 7,
			Max = 10
		}
	}

}

local FindFirstChild, FindFirstChildOfClass, WaitForChild = script.FindFirstChild, script.FindFirstChildOfClass, script.WaitForChild

local Clone, Destroy = script.Clone, script.Destroy

local GetChildren = script.GetChildren

local IsA = script.IsA

local Tool = script.Parent
Tool.Enabled = true

local DefaultGrip = FindFirstChild(Tool, "DefaultGrip") 
if not DefaultGrip then
	-- Create a new grip reference
	DefaultGrip = Instance.new("CFrameValue")
	DefaultGrip.Name = "DefaultGrip"
	DefaultGrip.Value = Tool.Grip
	DefaultGrip.Parent = Tool
end

Tool.Grip = DefaultGrip.Value --Reset the Tool's grip values to the DefaultGrip Value

local Handle = WaitForChild(Tool, "Handle")

pcall(function()
	Handle["Sparkle_Large_Blue"].Enabled = true --We're gonna use this as our visual indicator for our special.
end)

local Sounds = {
	Equip = WaitForChild(Handle, "Equip"),
	Slash = WaitForChild(Handle, "Slash"),
	Lunge = WaitForChild(Handle, "Lunge") 
}

local Players = (game:FindService("Players") or game:GetService("Players"))
local Debris = (game:FindService("Debris") or game:GetService("Debris"))
local RunService = (game:FindService("RunService") or game:GetService("RunService"))
local ServerScriptService = (game:FindService("ServerScriptService") or game:GetService("ServerScriptService"))

local NewRay = Ray.new
--[[ LawlR fix ]]--

local ds = game:GetService("Debris")
local ps = game:GetService("Players")

wait(1)

local tool = script.Parent
local handle = tool:WaitForChild("Handle")
local slashSound = handle.Slash
local lungeSound = handle.Lunge
local unsheathSound = handle.Unsheath

local baseDmg = 5
local slashDmg = 10
local lungeDmg = 20
local dmg = slashDmg
local gripUp = CFrame.new(0, 0, -2.35, 0, 0, 1, 1, 0, 0, 0, 1, 0)
local gripOut = CFrame.new(0, 0, -2.35, 0, 1, 0, 1, -0, 0, 0, 0, -1)
local lastAttack = 0

local plr, chr, hum
local db
local lastAttackTag

local attackAnimString = Instance.new("StringValue")
attackAnimString.Name = "toolanim"


local function tagHum(hum)
	local tag = Instance.new("ObjectValue")
	tag.Name = "creator"
	tag.Value = plr
	tag.Parent = hum
	ds:AddItem(tag, 2)
end

local function isTeamMate(hitPlr)
	return (hitPlr and plr and not hitPlr.Neutral and not plr.Neutral and hitPlr.TeamColor == plr.TeamColor)
end

local function onHit(hit)
	local hitHum = hit.Parent:FindFirstChildWhichIsA("Humanoid") or hit.Parent.Parent:FindFirstChildWhichIsA("Humanoid")
	if hitHum and hitHum.Health > 0 then
		if hitHum ~= hum then
			local hitChr = hitHum.Parent
			local hitPlr = ps:GetPlayerFromCharacter(hitChr)
			if hitPlr and isTeamMate(hitPlr) then
				return
			end
			tagHum(hitHum)
			hitHum:TakeDamage(dmg)
		end
	end
end

local function attack(tag)
	dmg = slashDmg
	slashSound:play()
	
	local anim = attackAnimString:Clone()
	anim.Value = "Slash"
	anim.Parent = tool
	
	coroutine.wrap(function()
		wait(.5)
		if lastAttackTag == tag then
			dmg = baseDmg
		end
	end)()
end

local function lunge()
	dmg = lungeDmg
	lungeSound:play()

	local anim = attackAnimString:Clone()
	anim.Value = "Lunge"
	anim.Parent = tool
	
	wait(.2)
	tool.Grip = gripOut
	wait(.6)
	tool.Grip = gripUp
	dmg = baseDmg
end


tool.Activated:Connect(function()
	if not db then
		db = true
		tool.Enabled = false
		local t = tick()
		lastAttackTag = t
	
		if (t - lastAttack < .2) then
			lunge()
		else
			attack(t)
		end
	
		lastAttack = t
		db = false
		tool.Enabled = true
	end
end)

tool.Equipped:Connect(function()
	unsheathSound:Play()
	lastAttack = tick()
	local tempChr = tool.Parent
	local tempHum = tempChr:FindFirstChildWhichIsA("Humanoid")
	if tempHum then
		chr = tempChr
		hum = tempHum
		plr = ps:GetPlayerFromCharacter(tempChr)
	end
end)


handle.Touched:Connect(function(hit)
	local toolParent = tool.Parent
	if toolParent and toolParent:IsA("Model") and toolParent ~= workspace then
		onHit(hit)
	end
end)
-- services

local ServerScriptService	= game:GetService("ServerScriptService")
local ReplicatedStorage		= game:GetService("ReplicatedStorage")
local TextService			= game:GetService("TextService")
local Chat					= game:GetService("Chat")
local Players				= game:GetService("Players")