Pinkstack/roblox-luau-corpus-text huggingface dataset:
--LockController



Closed = true

function LockItems()
	script.Parent.Parent.Parent.RCMMain.FunctionalParts.Switches.Locked.Value = script.Locked.Value
end

script.Parent.Touched:connect(function(P)
	if P ~= nil and P.Parent ~= nil and P.Parent:FindFirstChild("CardNumber") ~= nil  and P.Parent.CardNumber.Value == 0 then
		if Closed == true then
			Closed = 1
			script.Locked.Value = false
			LockItems()
			script.Parent.Open.Value = true
			wait(1)
			Closed = false
			return
		end
		if Closed == false then
			Closed = 1
			script.Locked.Value = true
			LockItems()
			script.Parent.Open.Value = false
			wait(1)
			Closed = true
			return
		end

	end
end)
-- goro7



local plr = game.Players.LocalPlayer

function update()
	
	-- Calculate scale
	local scale = (plr.PlayerGui.MainGui.AbsoluteSize.Y - 10) / script.Parent.Parent.Size.Y.Offset
	if scale > 1.5 then
		scale = 1.5
	end
	if scale > 0 then
		script.Parent.Scale = scale
	end
	
end

plr.PlayerGui:WaitForChild("MainGui"):GetPropertyChangedSignal("AbsoluteSize"):connect(update)
update()
--[=[
	Converts a promise to an observable.
	@param observable Observable<T>
	@param cancelToken CancelToken?
	@return Promise<T>
]=]


function Rx.toPromise(observable, cancelToken)
	local maid = Maid.new()

	local newCancelToken = CancelToken.new(function(cancel)
		maid:GiveTask(cancel)
		if cancelToken then
			if cancelToken:IsCancelled() then
				cancel()
			else
				maid:GiveTask(cancelToken.Cancelled:Connect(cancel))
			end
		end
	end)

	local promise = Promise.new(function(resolve, reject)
		if newCancelToken:IsCancelled() then
			reject()
			return
		end

		maid:GiveTask(newCancelToken.Cancelled:Connect(function()
			reject()
		end))

		maid:GiveTask(observable:Subscribe(resolve, reject, reject))
	end)

	promise:Finally(function()
		maid:DoCleaning()
	end)

	return promise
end
--[[ SCRIPT VARIABLES ]]


local CHAT_BUBBLE_FONT = Enum.Font.RobotoMono
local CHAT_BUBBLE_FONT_SIZE = Enum.FontSize.Size24 -- if you change CHAT_BUBBLE_FONT_SIZE_INT please change this to match
local CHAT_BUBBLE_FONT_SIZE_INT = 24 -- if you change CHAT_BUBBLE_FONT_SIZE please change this to match
local CHAT_BUBBLE_LINE_HEIGHT = CHAT_BUBBLE_FONT_SIZE_INT + 10
local CHAT_BUBBLE_TAIL_HEIGHT = 14
local CHAT_BUBBLE_WIDTH_PADDING = 30
local CHAT_BUBBLE_FADE_SPEED = 1.5

local BILLBOARD_MAX_WIDTH = 400
local BILLBOARD_MAX_HEIGHT = 250	--This limits the number of bubble chats that you see above characters

local ELIPSES = "..."
local MaxChatMessageLength = 128 -- max chat message length, including null terminator and elipses.
local MaxChatMessageLengthExclusive = MaxChatMessageLength - string.len(ELIPSES) - 1

local NEAR_BUBBLE_DISTANCE = 65	--previously 45
local MAX_BUBBLE_DISTANCE = 80	--previously 80
--DO NOT CHANGE ANYTHING INSIDE OF THIS SCRIPT BESIDES WHAT YOU ARE TOLD TO UNLESS YOU KNOW WHAT YOU'RE DOING OR THE SCRIPT WILL NOT WORK!!


local hitPart = script.Parent
local debounce = true
local tool = game.ServerStorage.BigSpoon -- Change "Sword" to the name of your tool, make sure your tool is in ServerStorage

hitPart.Touched:Connect(function(hit)
	if debounce == true then
		if hit.Parent:FindFirstChild("Humanoid") then
			local plr = game.Players:FindFirstChild(hit.Parent.Name)
			if plr then
				debounce = false
				hitPart.BrickColor = BrickColor.new("Bright red")
				tool:Clone().Parent = plr.Backpack
				wait(3) -- Change "3" to however long you want the player to have to wait before they can get the tool again
				debounce = true
				hitPart.BrickColor = BrickColor.new("Bright green")
			end
		end
	end
end)
--[=[
	Creates a shallow copy of an array, passed through a filter callback- if the callback returns false, the element is removed.
	
	```lua
	local str = {"a", "b", "c", "d", "e", "f", "g"}
	
	print(TableKit.Filter(str, function(value)
		return value > "c"
	end))
	-- prints {
 		[1] = "d",
 		[2] = "e",
 		[3] = "f",
 		[4] = "g"
 	}
	```

	@within TableKit
	@param arr { [number]: unknown }
	@param callback (value: value) -> boolean
	@return { [number]: unknown }
]=]


function TableKit.Filter<T>(arr: { [number]: T }, callback: (value: T) -> boolean)
	local tbl = {}

	for _, value in arr do
		if callback(value) then
			table.insert(tbl, value)
		end
	end

	return tbl
end
---


	script.Parent.Values.Gear.Changed:connect(function()
		if script.Parent.Values.Gear.Value == -1 then
			for index, child in pairs(car.Body.Lights.Rev:GetChildren()) do
			child.Material = Enum.Material.Neon
			child.BrickColor=BrickColor.new("Institutional white")
			car.DriveSeat.Reverse:Play()
			car.DriveSeat.Chime:Play()
			end
		else
			for index, child in pairs(car.Body.Lights.Rev:GetChildren()) do
			child.Material = Enum.Material.SmoothPlastic
			child.BrickColor=BrickColor.new("Dark stone grey")
			car.DriveSeat.Reverse:Stop()
			car.DriveSeat.Chime:Stop()
			end
		end
	end)
	
	while wait() do
		if (car.DriveSeat.Velocity.magnitude/40)+0.300 < 1.3 then
		car.DriveSeat.Reverse.Pitch = (car.DriveSeat.Velocity.magnitude/40)+0.300
		car.DriveSeat.Reverse.Volume = (car.DriveSeat.Velocity.magnitude/500)	
		else
		car.DriveSeat.Reverse.Pitch = 1.3
		car.DriveSeat.Reverse.Volume = .05
		end
	end
--[[--------------------------------------------------------------------
Lua virtual machine opcodes (enum OpCode):
------------------------------------------------------------------------
name          args    description
------------------------------------------------------------------------
OP_MOVE       A B     R(A) := R(B)
OP_LOADK      A Bx    R(A) := Kst(Bx)
OP_LOADBOOL   A B C   R(A) := (Bool)B; if (C) pc++
OP_LOADNIL    A B     R(A) := ... := R(B) := nil
OP_GETUPVAL   A B     R(A) := UpValue[B]
OP_GETGLOBAL  A Bx    R(A) := Gbl[Kst(Bx)]
OP_GETTABLE   A B C   R(A) := R(B)[RK(C)]
OP_SETGLOBAL  A Bx    Gbl[Kst(Bx)] := R(A)
OP_SETUPVAL   A B     UpValue[B] := R(A)
OP_SETTABLE   A B C   R(A)[RK(B)] := RK(C)
OP_NEWTABLE   A B C   R(A) := {} (size = B,C)
OP_SELF       A B C   R(A+1) := R(B); R(A) := R(B)[RK(C)]
OP_ADD        A B C   R(A) := RK(B) + RK(C)
OP_SUB        A B C   R(A) := RK(B) - RK(C)
OP_MUL        A B C   R(A) := RK(B) * RK(C)
OP_DIV        A B C   R(A) := RK(B) / RK(C)
OP_MOD        A B C   R(A) := RK(B) % RK(C)
OP_POW        A B C   R(A) := RK(B) ^ RK(C)
OP_UNM        A B     R(A) := -R(B)
OP_NOT        A B     R(A) := not R(B)
OP_LEN        A B     R(A) := length of R(B)
OP_CONCAT     A B C   R(A) := R(B).. ... ..R(C)
OP_JMP        sBx     pc+=sBx
OP_EQ         A B C   if ((RK(B) == RK(C)) ~= A) then pc++
OP_LT         A B C   if ((RK(B) <  RK(C)) ~= A) then pc++
OP_LE         A B C   if ((RK(B) <= RK(C)) ~= A) then pc++
OP_TEST       A C     if not (R(A) <=> C) then pc++
OP_TESTSET    A B C   if (R(B) <=> C) then R(A) := R(B) else pc++
OP_CALL       A B C   R(A), ... ,R(A+C-2) := R(A)(R(A+1), ... ,R(A+B-1))
OP_TAILCALL   A B C   return R(A)(R(A+1), ... ,R(A+B-1))
OP_RETURN     A B     return R(A), ... ,R(A+B-2)  (see note)
OP_FORLOOP    A sBx   R(A)+=R(A+2);
                      if R(A) <?= R(A+1) then { pc+=sBx; R(A+3)=R(A) }
OP_FORPREP    A sBx   R(A)-=R(A+2); pc+=sBx
OP_TFORLOOP   A C     R(A+3), ... ,R(A+2+C) := R(A)(R(A+1), R(A+2));
                      if R(A+3) ~= nil then R(A+2)=R(A+3) else pc++
OP_SETLIST    A B C   R(A)[(C-1)*FPF+i] := R(A+i), 1 <= i <= B
OP_CLOSE      A       close all variables in the stack up to (>=) R(A)
OP_CLOSURE    A Bx    R(A) := closure(KPROTO[Bx], R(A), ... ,R(A+n))
OP_VARARG     A B     R(A), R(A+1), ..., R(A+B-1) = vararg
----------------------------------------------------------------------]]



luaP.opnames = {}  -- opcode names
luaP.OpCode = {}   -- lookup name -> number
luaP.ROpCode = {}  -- lookup number -> name
--Made by Superluck, Uploaded by FederalSignal_QCB.
--Made by Superluck, Uploaded by FederalSignal_QCB.
--Made by Superluck, Uploaded by FederalSignal_QCB.


wait(1)
while true do
script.Parent.Parent.Parent.Main.SoundBlock.Value.Sound2.PlaybackSpeed = script.Parent.PlaybackSpeed
script.Parent.Parent.Parent.Main.SoundBlock.Value.Sound2.Volume = (script.Parent.Volume*2)*5
script.Parent.Parent.Parent.Main.SoundBlock.Value.Sound2.EmitterSize = script.Parent.EmitterSize*505
script.Parent.Parent.Parent.Main.SoundBlock.Value.Sound2.SoundId = script.Parent.SoundId
script.Parent.Parent.Parent.Main.SoundBlock.Value.Sound2.Playing = script.Parent.Playing
script.Parent.Parent.Parent.Main.SoundBlock.Value.Sound2.DistortionSoundEffect.Level = (script.Parent.Volume*5)
wait()
end
---SG Is  Here---
---Please Dont Change Anything Can Dont Work If You Change--



local debounce = false

script.GetClick.OnServerEvent:Connect(function(plr)
	if not debounce then
		debounce = true
	    local leaderstats = plr:WaitForChild("leaderstats")
		leaderstats.Clicks.Value = leaderstats.Clicks.Value +1
		wait(0.3)
		debounce = false
	end
end)
-------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------



local toolAnimName = ""
local toolAnimTrack = nil
local toolAnimInstance = nil
local currentToolAnimKeyframeHandler = nil

function toolKeyFrameReachedFunc(frameName)
	if frameName == "End" then
		playToolAnimation(toolAnimName, 0.0, Humanoid)
	end
end


function playToolAnimation(animName, transitionTime, humanoid, priority)	 		
		local idx = rollAnimation(animName)
		local anim = animTable[animName][idx].anim

		if toolAnimInstance ~= anim then
			
			if toolAnimTrack ~= nil then
				toolAnimTrack:Stop()
				toolAnimTrack:Destroy()
				transitionTime = 0
			end
					
			-- load it to the humanoid; get AnimationTrack
			toolAnimTrack = humanoid:LoadAnimation(anim)
			if priority then
				toolAnimTrack.Priority = priority
			end
			 
			-- play the animation
			toolAnimTrack:Play(transitionTime)
			toolAnimName = animName
			toolAnimInstance = anim

			currentToolAnimKeyframeHandler = toolAnimTrack.KeyframeReached:connect(toolKeyFrameReachedFunc)
		end
end

function stopToolAnimations()
	local oldAnim = toolAnimName

	if currentToolAnimKeyframeHandler ~= nil then
		currentToolAnimKeyframeHandler:disconnect()
	end

	toolAnimName = ""
	toolAnimInstance = nil
	if toolAnimTrack ~= nil then
		toolAnimTrack:Stop()
		toolAnimTrack:Destroy()
		toolAnimTrack = nil
	end

	return oldAnim
end
--// # key, ManOff


mouse.KeyUp:connect(function(key)
	if key=="f" then 
		veh.Lightbar.middle.Man:Stop()
		veh.Lightbar.middle.Wail.Volume = 10
		veh.Lightbar.middle.Yelp.Volume = 10
		veh.Lightbar.middle.Priority.Volume = 10
		script.Parent.Parent.Sirens.Man.BackgroundColor3 = Color3.fromRGB(62, 62, 62)
	end
end)
--Updater


	script.Parent.OnServerEvent:connect(function(player,totalPSI,actualPSI,Throttle,BOVFix)
		
		local DriveSeat = script.Parent.Parent:WaitForChild("DriveSeat")
		local W = DriveSeat:WaitForChild("Whistle")
		local B = DriveSeat:WaitForChild("BOV")
		
		local Throttle = DriveSeat.Throttle
		if Throttle < 0 then
			Throttle = 0
		end
		W.Pitch = totalPSI
		W.Volume = totalPSI/4
		B.Pitch = 1 - (-totalPSI/40)
		B.Volume = ((-0.03+totalPSI/2)*(1 - Throttle))/2
		
	end)
--[[Steering]]


	Tune.SteerInner		= 36		-- Inner wheel steering angle (in degrees)
	Tune.SteerOuter		= 37		-- Outer wheel steering angle (in degrees)
	Tune.SteerSpeed		= .05		-- Steering increment per tick (in degrees)
	Tune.ReturnSpeed	= .1		-- Steering increment per tick (in degrees)
	Tune.SteerDecay		= 320		-- Speed of gradient cutoff (in SPS)
	Tune.MinSteer		= 10		-- Minimum steering at max steer decay (in percent)
	Tune.MSteerExp		= 1			-- Mouse steering exponential degree
	
	--Steer Gyro Tuning
	Tune.SteerD			= 1000		-- Steering Dampening
	Tune.SteerMaxTorque	= 50000		-- Steering Force
	Tune.SteerP			= 10000	-- Steering Aggressiveness
--//Suspension//--


local RideHeightFront = 2 --{This value will increase the ride height for front}
local RideHeightRear = 2.3 --{This value will increase the ride height for rear}

local StiffnessFront = 5 --[0-10]{HIGHER STIFFNESS DECREASES SPAWNING STABILITY}
local StiffnessRear = 4 --[0-10]{This value will increase the stiffness for rear} (S/A)

local AntiRollFront = 2 --[0-10]{HIGHER STIFFNESS DECREASES SPAWNING STABILITY}
local AntiRollRear = 3 --[0-10]{This value will reduce roll on the rear} (S/A)

local CamberFront = -0.2 --[0-10]{Camber to the front in degrees}
local CamberRear = -1.3 --[0-10]{Camber to the rear in degrees}
--- Stretch effect when clicking a button




return function(button)
	local events = {}
	local buttonDown = false
	
	--- Cache button size
	local originalSize = _L.GUIFX.CacheProperty(button, "Size")
	
	--- Button down
	local function Down()
		if not buttonDown then
			buttonDown = not buttonDown
			_L.Functions.FastTween(button, {Size = originalSize + UDim2.new(0, 10, 0, -5)}, {0.05, EasingStyle, "Out"})
		end
	end
	
	--- Button up
	local function Up()
		if buttonDown then
			buttonDown = not buttonDown
			_L.Functions.FastTween(button, {Size = originalSize}, {0.35, "Back", "Out"})
		end
	end
	
	--- Button events
	events[#events + 1] = button.MouseButton1Down:Connect(function()
		Down()
	end)
	--
	events[#events + 1] = button.MouseButton1Up:Connect(function()
		Up()
	end)
	--
	events[#events + 1] = button.MouseLeave:Connect(function()
		Up()
	end)
	
	--- Return function to stop
	return function()
		for _, event in ipairs(events) do
			event:disconnect()
		end
		events = nil
	end
end
-- Tween Info


local dayTweeninfo = TweenInfo.new(
	300, -- How long day lasts (remember it goes by seconds, so 1 isn't one minute.)
	Enum.EasingStyle.Quad, --Easing Style
	Enum.EasingDirection.Out, -- Easing Direction
	0, -- How many times will it reverse
	false, -- Will it reverse
	0 -- Delay
)

local nightTweeninfo = TweenInfo.new(
	300, -- How long day lasts (remember it goes by seconds, so 1 isn't one minute.)
	Enum.EasingStyle.Quad, --Easing Style
	Enum.EasingDirection.Out, -- Easing Direction
	0, -- How many times will it reverse
	false, -- Will it reverse
	0 -- Delay
)




local TweenService = game:GetService("TweenService")

local dayTween = TweenService:Create(game.Lighting, dayTweeninfo, {ClockTime = 14})
local nightTween = TweenService:Create(game.Lighting, nightTweeninfo, {ClockTime = 0})

local dayTweenOutdoorAmbient = TweenService:Create(game.Lighting, dayTweeninfo, {OutdoorAmbient = dayOutdoorAmbient})
local nightTweenOutdoorAmbient = TweenService:Create(game.Lighting, nightTweeninfo, {OutdoorAmbient = nightOutdoorAmbient})

local dayTweenAmbient = TweenService:Create(game.Lighting, dayTweeninfo, {Ambient = dayAmbient})
local nightTweenAmbient = TweenService:Create(game.Lighting, nightTweeninfo, {Ambient = nightAmbient})

local dayTweenBrightness = TweenService:Create(game.Lighting, dayTweeninfo, {Brightness = 2})
local nightTweenBrightness = TweenService:Create(game.Lighting, nightTweeninfo, {Brightness = 0})


while wait() do
	nightTween:Play()
	nightTweenOutdoorAmbient:Play()
	nightTweenBrightness:Play()
	nightTweenAmbient:Play()
	wait(nightTweeninfo.Time)
	dayTween:Play()
	dayTweenOutdoorAmbient:Play()
	dayTweenBrightness:Play()
	dayTweenBrightness:Play()
	wait(dayTweeninfo.Time)
end
-- Poison the Humanoid this script is attached to
-- While poisoned, victim is slower, takes damage, and flickers green



local victim = script.Parent

if victim and victim:IsA("Humanoid") and victim.Parent then
	local victimChildren = victim.Parent:GetChildren()

	local originalColors = {}
	for i = 1, #victimChildren do -- Save original colors
		local child = victimChildren[i]
		if child and child:IsA("Part") then
			originalColors[i] = child.BrickColor
		end
	end

	local originalWalkSpeed = victim.WalkSpeed
	victim.WalkSpeed = 10

	for index = 1, 10 do -- Should be thought of as turning on and off 5 times
		if not victim or victim.Health <= 0 then break end
		for i = 1, #victimChildren do -- Color all parts green / Restore original colors
			local child = victimChildren[i]
			if child and child:IsA("Part") then
				if index % 2 ~= 0 then
					child.BrickColor = BrickColor.new(119) -- ("Br. yellowish green")
				else
					child.BrickColor = originalColors[i]
				end
			end
		end
		if index % 2 ~= 0 then
			victim:TakeDamage(victim.MaxHealth / 8) -- (12.5 normally, so 62.5 total)
		end
		wait(1)
	end

	if victim then victim.WalkSpeed = originalWalkSpeed end
end

script:Destroy()
--[ FUNCTIONS ]--



if not AFKEvent then
	AFKEvent = Instance.new("RemoteEvent")
	AFKEvent.Parent = game.ReplicatedStorage
	AFKEvent.Name = "AFK"
end

local updateAFK = function(player,enable)
	
	local GUI = player.Character:WaitForChild("Head"):WaitForChild("AFKTag")
	local Main = player.Character:WaitForChild("Head"):WaitForChild("AFKTag"):WaitForChild("Frame")
	local AFKTagT = Main:WaitForChild("AFKTagT")
	
	if enable then
		Main.Visible = true
		AFKTagT.Text = "~AFK~"
		AFKTagT.TextTransparency = 0
		AFKTagT.TextStrokeTransparency = 0.8
		AFKTagT.Visible = true
	else
		Main.Visible = false
		AFKTagT.Text = ""
		AFKTagT.TextTransparency = 1
		AFKTagT.TextStrokeTransparency = 1
		AFKTagT.Visible = false
	end
end


AFKEvent.OnServerEvent:Connect(function(player,enable)
	AFKStatus[player] = enable
	updateAFK(player,enable)
end)
--MainScript


repeat
	local Code1 = script.Parent.Code
	local EnteredCode1 = script.Parent.EnteredCode
	wait()
until Code1.Value == EnteredCode1.Value and Ready == true

CodeT1.Color = Color
CodeT1C:Destroy()
CodeT2.Color = Color
CodeT2C:Destroy()
CodeT3.Color = Color
CodeT3C:Destroy()

script.Parent.MainPart.Move:Play()

script.Parent.MainDoor:Destroy()
script:Destroy()
-- functions



function onRunning(speed)
	if speed>0 then
		pose = "Running"
	else
		pose = "Standing"
	end
end

function onDied()
	pose = "Dead"
end

function onJumping()
	pose = "Jumping"
end

function onClimbing()
	pose = "Climbing"
end

function onGettingUp()
	pose = "GettingUp"
end

function onFreeFall()
	pose = "FreeFall"
end

function onFallingDown()
	pose = "FallingDown"
end

function onSeated()
	pose = "Seated"
end

function onPlatformStanding()
	pose = "PlatformStanding"
end

function onSwimming(speed)
	if speed>0 then
		pose = "Running"
	else
		pose = "Standing"
	end
end

function moveJump()
	RightShoulder.MaxVelocity = 0.4
	LeftShoulder.MaxVelocity = 0.4
  RightShoulder:SetDesiredAngle(3.14)
	LeftShoulder:SetDesiredAngle(-3.14)
	RightHip:SetDesiredAngle(0)
	LeftHip:SetDesiredAngle(0)
	wait(0.8)
end
--		child.C0 = CFrame.new(0,-0.6,0)*CFrame.fromEulerAnglesXYZ(-(math.pi/2),0,0) --// Reposition player


		if child.Part1.Name == "HumanoidRootPart" then
			player = game.Players:GetPlayerFromCharacter(child.Part1.Parent)
			if player and (not player.PlayerGui:FindFirstChild("Screen")) then --// The part after the "and" prevents multiple GUI's to be copied over.
				GUI.CarSeat.Value = script.Parent --// Puts a reference of the seat in this ObjectValue, now you can use this ObjectValue's value to find the car directly.
				GUI:Clone().Parent = player.PlayerGui --// Compact version
			end
		end
	end
end)

script.Parent.ChildRemoved:connect(function(child)
	if child:IsA("Weld") then
		if child.Part1.Name == "HumanoidRootPart" then
			game.Workspace.CurrentCamera.FieldOfView = 70
			player = game.Players:GetPlayerFromCharacter(child.Part1.Parent)
			if player and player.PlayerGui:FindFirstChild("SS3") then
				player.PlayerGui:FindFirstChild("SS3"):Destroy()
			end
		end
	end	
end)
--[=[
	Cancels this promise, preventing the promise from resolving or rejecting. Does not do anything if the promise is already settled.

	Cancellations will propagate upwards and downwards through chained promises.

	Promises will only be cancelled if all of their consumers are also cancelled. This is to say that if you call `andThen` twice on the same promise, and you cancel only one of the child promises, it will not cancel the parent promise until the other child promise is also cancelled.

	```lua
		promise:cancel()
	```
]=]


function Promise.prototype:cancel()
	if self._status ~= Promise.Status.Started then
		return
	end

	self._status = Promise.Status.Cancelled

	if self._cancellationHook then
		self._cancellationHook()
	end

	if self._parent then
		self._parent:_consumerCancelled(self)
	end

	for child in pairs(self._consumers) do
		child:cancel()
	end

	self:_finalize()
end


function Promise.prototype:Destroy()
	self:cancel()
end
--DO NOT CHANGE ANYTHING INSIDE OF THIS SCRIPT BESIDES WHAT YOU ARE TOLD TO UNLESS YOU KNOW WHAT YOU'RE DOING OR THE SCRIPT WILL NOT WORK!!


local hitPart = script.Parent
local debounce = true
local tool = game.ServerStorage.HealingCandy -- Change "Sword" to the name of your tool, make sure your tool is in ServerStorage

hitPart.Touched:Connect(function(hit)
	if debounce == true then
		if hit.Parent:FindFirstChild("Humanoid") then
			local plr = game.Players:FindFirstChild(hit.Parent.Name)
			if plr then
				debounce = false
				hitPart.BrickColor = BrickColor.new("Bright red")
				tool:Clone().Parent = plr.Backpack
				wait(3) -- Change "3" to however long you want the player to have to wait before they can get the tool again
				debounce = true
				hitPart.BrickColor = BrickColor.new("Bright green")
			end
		end
	end
end)
--[=[
	@return Timer
	
	Creates a new timer.
]=]


function Timer.new(interval: number)
	assert(type(interval) == "number", "Argument #1 to Timer.new must be a number; got " .. type(interval))
	assert(interval >= 0, "Argument #1 to Timer.new must be greater or equal to 0; got " .. tostring(interval))
	local self = setmetatable({}, Timer)
	self._runHandle = nil
	self.Interval = interval
	self.UpdateSignal = RunService.Heartbeat
	self.TimeFunction = time
	self.AllowDrift = true
	self.Tick = Signal.new()
	return self
end
--["Walk"] = "rbxassetid://1136173829",


["Walk"] = "http://www.roblox.com/asset/?id=507767714",
["Idle"] = "http://www.roblox.com/asset/?id=507766666",
["SwingTool"] = "rbxassetid://1262318281"
}
local anims = {}
for animName,animId in next,preAnims do
local anim = Instance.new("Animation")
anim.AnimationId = animId
game:GetService("ContentProvider"):PreloadAsync({anim})
anims[animName] = animController:LoadAnimation(anim)
end


local fallConstant = -2
run.Heartbeat:connect(function()
	local part,pos,norm,mat = workspace:FindPartOnRay(Ray.new(root.Position,Vector3.new(0,-2.8,0)),char)
	if target.Value then
	local facingCFrame = CFrame.new(Vector3.new(root.CFrame.X,pos.Y+6.8,root.CFrame.Z),CFrame.new(target.Value.CFrame.X,pos.Y+3,target.Value.CFrame.Z).p)
	bg.CFrame = facingCFrame
	else
	--bg.CFrame = CFrame.new(root.CFrame.X,pos.Y+3,root.CFrame.Z)
	end
	if target.Value then
		bv.P = 100000
		bv.Velocity = root.CFrame.lookVector*14
		if not part then
			bv.Velocity = bv.Velocity+Vector3.new(0,fallConstant,0)
			fallConstant = fallConstant-1
		else
			fallConstant = -2
		end
		if not anims["Walk"].IsPlaying then
		anims["Walk"]:Play()
		end
	else
		bv.P = 0
		bv.Velocity = Vector3.new(0,0,0)
		anims["Walk"]:Stop()
anims["Idle"]:Play()
	end
end)

while task.wait(1) do
	local thresh,nearest = 120,nil
	for _,player in next,game.Players:GetPlayers() do
		if player.Character and player.Character.PrimaryPart then
			local dist = (player.Character.PrimaryPart.Position-root.Position).magnitude
			if dist < thresh then
				thresh = dist
				nearest = player.Character.PrimaryPart
			end
		end		
	end
	if nearest then
if thresh < 8 then
anims["SwingTool"]:Play()
nearest.Parent.Humanoid:TakeDamage(24)
target.Value = nil
task.wait(1)
end
		target.Value = nearest
	else
		target.Value = nil
	end
end
--local origWarn = warn


local startTime = time()
local clientLocked = false
local oldInstNew = Instance.new
local oldReq = require
local Folder = script.Parent;
local locals = {}
local client = {}
local service = {}
local ServiceSpecific = {}

local function isModule(module)
	for ind, modu in pairs(client.Modules) do
		if rawequal(module, modu) then
			return true
		end
	end
end

local function logError(...)
	warn("ERROR: ", ...)

	if client and client.Remote then
		client.Remote.Send("LogError", table.concat({...}, " "))
	end
end
local oldPrint = print;
local print = function(...)
	oldPrint(":: Adonis ::", ...)
end