Pinkstack/roblox-luau-corpus-text huggingface dataset:
--Constructor and destructor


function touch_button:New(parent_frame, pos, size)
	--Initialize meta reference
	local self = setmetatable({}, {__index = touch_button})

	--Create button
	self.button = Instance.new("ImageButton")
	self.button.Name = "Button"
	self.button.BackgroundTransparency = 1
	self.button.ImageTransparency = 1
	self.button.ImageColor3 = released_col
	self.button.Active = false
	self.button.Size = size
	self.button.Position = pos
	self.button.Parent = parent_frame

	--Initialize state
	self.pressed = false
	self.move_touch_input = nil
	self.enabled = false

	--Input connections
	self.input_connections = {
		self.button.InputBegan:Connect(function(input)
			--Make sure input is a valid state
			if self.enabled == false or self.move_touch_input ~= nil or input.UserInputType ~= Enum.UserInputType.Touch or input.UserInputState ~= Enum.UserInputState.Begin then
				return
			end

			--Start holding button
			self.move_touch_input = input
			self.button.ImageColor3 = pressed_col
			self.pressed = true
		end),
		uis.TouchEnded:Connect(function(input, processed)
			if input == self.move_touch_input then
				OnInputEnded(self)
			end
		end),
		gui_service.MenuOpened:Connect(function()
			if self.move_touch_input ~= nil then
				OnInputEnded(self)
			end
		end),
	}

	return self
end

function touch_button:Destroy()
	--Disconnect connections
	if self.input_connections ~= nil then
		for _,v in pairs(self.input_connections) do
			v:Disconnect()
		end
		self.input_connections = nil
	end

	--Destroy button
	if self.button ~= nil then
		self.button:Destroy()
		self.button = nil
	end
end
--[[Engine]]


	--Torque Curve
	Tune.Horsepower		= 450		--	[TORQUE CURVE VISUAL]
	Tune.IdleRPM		= 700		--		https://www.desmos.com/calculator/2uo3hqwdhf
	Tune.PeakRPM		= 6000		--		Use sliders to manipulate values
	Tune.Redline		= 7000		--		Copy and paste slider values into the respective tune values
	Tune.EqPoint		= 5500
	Tune.PeakSharpness	= 7.5
	Tune.CurveMult		= 0.16
	
	--Incline Compensation
	Tune.InclineComp	= 5 			-- Torque compensation multiplier for inclines (applies gradient from 0-90 degrees)
	
	--Misc
	Tune.RevAccel		= 150		-- RPM acceleration when clutch is off
	Tune.RevDecay		= 75		-- RPM decay when clutch is off
	Tune.RevBounce		= 500		-- RPM kickback from redline
	Tune.IdleThrottle	= 3			-- Percent throttle at idle
	Tune.ClutchTol		= 500		-- Clutch engagement threshold (higher = faster response)
---------------------------------------------------



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)

Lift:WaitForChild("Velocity").Changed:connect(function(val)
  --custom indicator code--
	if val == 0 then
		for i=1,8,1 do
			ChangeFloor(tostring("NIL"))
			wait(0.2)
			ChangeFloor(tostring(Lift:WaitForChild("Floor").Value))
			wait(0.2)
		end
	end
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
-------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------



function onSwimming(speed)
	if speed > 1.00 then
		local scale = 10.0
		playAnimation("swim", 0.4, Humanoid)
		setAnimationSpeed(speed / scale)
		pose = "Swimming"
	else
		playAnimation("swimidle", 0.4, Humanoid)
		pose = "Standing"
	end
end

function animateTool()
	if (toolAnim == "None") then
		playToolAnimation("toolnone", toolTransitionTime, Humanoid, Enum.AnimationPriority.Idle)
		return
	end

	if (toolAnim == "Slash") then
		playToolAnimation("toolslash", 0, Humanoid, Enum.AnimationPriority.Action)
		return
	end

	if (toolAnim == "Lunge") then
		playToolAnimation("toollunge", 0, Humanoid, Enum.AnimationPriority.Action)
		return
	end
end

function getToolAnim(tool)
	for _, c in ipairs(tool:GetChildren()) do
		if c.Name == "toolanim" and c.className == "StringValue" then
			return c
		end
	end
	return nil
end

local lastTick = 0

function stepAnimate(currentTime)
	local amplitude = 1
	local frequency = 1
	local deltaTime = currentTime - lastTick
	lastTick = currentTime

	local climbFudge = 0
	local setAngles = false

	if jumpAnimTime > 0 then
		jumpAnimTime = jumpAnimTime - deltaTime
	end

	if pose == "FreeFall" and jumpAnimTime <= 0 then
		playAnimation("fall", fallTransitionTime, Humanoid)
	elseif (pose == "Seated") then
		playAnimation("sit", 0.5, Humanoid)
		return
	elseif (pose == "Running") then
		playAnimation("walk", 0.2, Humanoid)
	elseif (pose == "Dead" or pose == "GettingUp" or pose == "FallingDown" or pose == "Seated" or pose == "PlatformStanding") then
		stopAllAnimations()
		amplitude = 0.1
		frequency = 1
		setAngles = true
	end

	-- Tool Animation handling
	local tool = Character:FindFirstChildOfClass("Tool")
	if tool and tool:FindFirstChild("Handle") then
		local animStringValueObject = getToolAnim(tool)
		if animStringValueObject then
			toolAnim = animStringValueObject.Value
			-- message recieved, delete StringValue
			animStringValueObject.Parent = nil
			toolAnimTime = currentTime + .3
		end
		if currentTime > toolAnimTime then
			toolAnimTime = 0
			toolAnim = "None"
		end
		animateTool()
	else
		stopToolAnimations()
		toolAnim = "None"
		toolAnimInstance = nil
		toolAnimTime = 0
	end
end
--[[
	Constructs and returns a new instance, with options for setting properties,
	event handlers and other attributes on the instance right away.
]]



local Package = script.Parent.Parent
local PubTypes = require(Package.PubTypes)
local defaultProps = require(Package.Instances.defaultProps)
local applyInstanceProps = require(Package.Instances.applyInstanceProps)
local logError= require(Package.Logging.logError)

local function New(className: string)
	return function(props: PubTypes.PropertyTable): Instance
		local ok, instance = pcall(Instance.new, className)

		if not ok then
			logError("cannotCreateClass", nil, className)
		end

		local classDefaults = defaultProps[className]
		if classDefaults ~= nil then
			for defaultProp, defaultValue in pairs(classDefaults) do
				instance[defaultProp] = defaultValue
			end
		end

		applyInstanceProps(props, instance)

		return instance
	end
end

return New
-- capture two separate generic arguments so that the type error in abuse cases is actionable, but needs CLI-49876 to avoid a false negative


local function concat<T, S>(source: Array<T> | T, ...: Array<S> | S): Array<T> & Array<S>
	local array
	local elementCount = 0

	if isArray(source) then
		array = table.clone(source :: Array<T>)
		elementCount = #(source :: Array<T>)
	else
		elementCount += 1
		array = {}
		array[elementCount] = source :: T
	end

	for i = 1, select("#", ...) do
		local value = select(i, ...)
		local valueType = typeof(value)
		if value == nil then
			-- do not insert nil
		elseif valueType == "table" then
			-- deviation: assume that table is an array, to avoid the expensive
			-- `isArray` check. In DEV mode, we throw if it is given an object-like
			-- table.
			if _G.__DEV__ then
				if not isArray(value) then
					error(RECEIVED_OBJECT_ERROR)
				end
			end
			for k = 1, #value do
				elementCount += 1
				array[elementCount] = value[k]
			end
		else
			elementCount += 1
			array[elementCount] = value
		end
	end

	return (array :: any) :: Array<T> & Array<S>
end

return concat
--Unequip a title for a player


function functions.UnequipTitle(plr: Player)

	local plrStats = plr:WaitForChild("leaderstats")
	local plrEquippedTitle = plr.EquippedTitle

	if plrEquippedTitle.Value ~= "" then

		local char = plr.Character
		if char.HumanoidRootPart:FindFirstChild("TITLE BILLBOARD GUI") then
			char.HumanoidRootPart["TITLE BILLBOARD GUI"]:Destroy()
		end

		plrEquippedTitle.Value = ""
	end
end
--[[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	= "RPM"												--[[
	[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		= 3.70			-- Gearing determines top speed and wheel torque
	Tune.Ratios			= {				-- Higher ratio = more torque, Lower ratio = higher top speed
		--[[Reverse]]	3.42		,	-- Copy and paste a ratio to add a gear
		--[[Neutral]]	0			,	-- Ratios can also be deleted
		--[[ 1 ]]		3.75		,	-- Reverse, Neutral, and 1st gear are required
		--[[ 2 ]]		2.38		,
		--[[ 3 ]]		1.72		,
		--[[ 4 ]]		1.34		,
		--[[ 5 ]]		1.11		,
		--[[ 6 ]]		.78			,
	}
	Tune.FDMult			= 1			-- Ratio multiplier (Change this value instead of FinalDrive if car is struggling with torque ; Default = 1)
----------------------------------------------------------------------------------------------------
-----------------=[ RECOIL & PRECISAO ]=------------------------------------------------------------
----------------------------------------------------------------------------------------------------


	,VRecoil = {14,18}				--- Vertical Recoil
	,HRecoil = {6,9}				--- Horizontal Recoil
	,AimRecover = 1					---- Between 0 & 1
	
	,RecoilPunch = .35
	,VPunchBase = 6					--- Vertical Punch
	,HPunchBase = 2					--- Horizontal Punch
	,DPunchBase = 1 				--- Tilt Punch | useless
	
	,AimRecoilReduction = 1 		--- Recoil Reduction Factor While Aiming (Do not set to 0)
	,PunchRecover = 0.2
	,MinRecoilPower = 1
	,MaxRecoilPower = 3
	,RecoilPowerStepAmount = .5
	
	,MinSpread = 4					--- Min bullet spread value | Studs
	,MaxSpread = 40					--- Max bullet spread value | Studs
	,AimInaccuracyStepAmount = 2.5
	,WalkMultiplier = 0				--- Bullet spread based on player speed

	,SwayBase = 0.25				--- Weapon Base Sway | Studs
	,MaxSway =	1					--- Max sway value based on player stamina | Studs
--Loop For Making Rays For The Bullet's Trajectory


for i = 1, 30 do
	local thisOffset = offset + Vector3.new(0, yOffset*(i-1), 0)
	local travelRay = Ray.new(point1,thisOffset)
	local hit, position = workspace:FindPartOnRay(travelRay, parts.Parent)

	local distance 		= (position - point1).magnitude
	round.Size				= Vector3.new(0.6, distance, 0.6)
	round.CFrame			= CFrame.new(position, point1)
								* CFrame.new(0, 0, -distance/2)
								* CFrame.Angles(math.rad(90),0,0)
	round.Parent			= workspace
	point1					= point1 + thisOffset
	
	if hit then
  round:remove()
  local e = Instance.new("Explosion")
  e.BlastRadius = 8
  e.BlastPressure = 1600
  e.Position = position
  e.Parent = workspace
  e.ExplosionType = Enum.ExplosionType.NoCraters
  e.DestroyJointRadiusPercent = 0.02
  
  local players = game.Players:getChildren()
  for i = 1, #players do
   
   if players[i].TeamColor ~= script.Parent.Parent.Tank.Value then --if he's not an ally
    character = players[i].Character
    if character then
     torso = character:findFirstChild'Torso'
     if torso then
      
      torsoPos = torso.Position
      origPos = round.Position
      
      local ray = Ray.new(origPos, torsoPos-origPos)
      local hit, position = game.Workspace:FindPartOnRayWithIgnoreList(ray,ignoreList)
      if hit then
       if hit.Parent == character then
        human = hit.Parent:findFirstChild("Humanoid")
        if human then
         distance = (position-origPos).magnitude
-- Make a base cosmetic bullet object. This will be cloned every time we fire off a ray.


local CosmeticBullet = Instance.new("Part")
CosmeticBullet.Material = Enum.Material.Neon
CosmeticBullet.Color = Color3.fromRGB(255, 225, 0)
CosmeticBullet.CanCollide = false
CosmeticBullet.Anchored = true
CosmeticBullet.Size = Vector3.new(0.2, 0.2, 2.4)
--// wonuf



wait()

local WeldHoldPart = script.Parent.Parent.Base --What everything will be welded to

function weld(c1,c2)
	c2.Anchored = false
	local w = Instance.new("Weld")
	w.Part0 = c1
	w.Part1 = c2
	w.C1 = c2.CFrame:inverse() * c1.CFrame
	w.Parent = WeldHoldPart
end

function scan(obj)
	for _,v in pairs(obj:GetChildren()) do
		if v:IsA('BasePart') then
			weld(WeldHoldPart, v)
			scan(v)
		else
			scan(v)
		end
	end
end

scan(script.Parent) --Whatever you want to scan/weld
-- -- -- -- -- -- -- -- -- -- -- -- -- -- --
--Intoducing: Ramen can't script for crap--
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 




Elevator:WaitForChild("Direction").Changed:connect(function(val)
	if val == 1 then
		This.Display.ARW1.UP.BrickColor = BrickColor.new(ActiveColour)
		This.Display.ARW1.UP.Material = "Neon"
		This.Display.ARW1.UP2.BrickColor = BrickColor.new(ActiveColour)
		This.Display.ARW1.UP2.Material = "Neon"
		This.Display.ARW1.MID.BrickColor = BrickColor.new(ActiveColour)
		This.Display.ARW1.MID.Material = "Neon"
		This.Display.ARW1.DOWN.BrickColor = BrickColor.new(InactiveColour)
		This.Display.ARW1.DOWN.Material = "SmoothPlastic"
		This.Display.ARW1.DOWN2.BrickColor = BrickColor.new(InactiveColour)
		This.Display.ARW1.DOWN2.Material = "SmoothPlastic"
	elseif val == -1 then
		This.Display.ARW1.UP.BrickColor = BrickColor.new(InactiveColour)
		This.Display.ARW1.UP.Material = "SmoothPlastic"
		This.Display.ARW1.UP2.BrickColor = BrickColor.new(InactiveColour)
		This.Display.ARW1.UP2.Material = "SmoothPlastic"
		This.Display.ARW1.DOWN.BrickColor = BrickColor.new(ActiveColour)
		This.Display.ARW1.DOWN.Material = "Neon"
		This.Display.ARW1.DOWN2.BrickColor = BrickColor.new(ActiveColour)
		This.Display.ARW1.DOWN2.Material = "Neon"
		This.Display.ARW1.MID.BrickColor = BrickColor.new(ActiveColour)
		This.Display.ARW1.MID.Material = "Neon"
	else
		This.Display.ARW1.UP.BrickColor = BrickColor.new(InactiveColour)
		This.Display.ARW1.UP.Material = "SmoothPlastic"
		This.Display.ARW1.UP2.BrickColor = BrickColor.new(InactiveColour)
		This.Display.ARW1.UP2.Material = "SmoothPlastic"
		This.Display.ARW1.DOWN.BrickColor = BrickColor.new(InactiveColour)
		This.Display.ARW1.DOWN.Material = "SmoothPlastic"
		This.Display.ARW1.DOWN2.BrickColor = BrickColor.new(InactiveColour)
		This.Display.ARW1.DOWN2.Material = "SmoothPlastic"
		This.Display.ARW1.MID.BrickColor = BrickColor.new(InactiveColour)
		This.Display.ARW1.MID.Material = "SmoothPlastic"
	end
end)
--[[
	LegacyCamera - Implements legacy controller types: Attach, Fixed, Watch
	2018 Camera Update - AllYourBlox
--]]



local ZERO_VECTOR2 = Vector2.new()
local PITCH_LIMIT = math.rad(80)

local Util = require(script.Parent:WaitForChild("CameraUtils"))
local CameraInput = require(script.Parent:WaitForChild("CameraInput"))
------------------
--SPAWNING--
------------------



miked=script.Parent

itlh=miked.Torso:findFirstChild("Left Hip")
itlh.Part0=miked.Torso
itlh.Part1=miked:findFirstChild("Left Leg")
itlh.C0=CFrame.new(-1, 0, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)

itrh=miked.Torso:findFirstChild("Right Hip")
itrh.Part0=miked.Torso
itrh.Part1=miked:findFirstChild("Right Leg")
itrh.C0=CFrame.new(1, 0, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)

itls=miked.Torso:findFirstChild("Left Shoulder")
itls.Part1=miked.Torso
itls.C0=CFrame.new(2, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
itls.Part0=miked:findFirstChild("Left Arm")

itrs=miked.Torso:findFirstChild("Right Shoulder")
itrs.Part1=miked.Torso
itrs.C0=CFrame.new(-2, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)
itrs.Part0=miked:findFirstChild("Right Arm")

miked.Head:makeJoints()
---- Create motors


local rightMotor = Instance.new("Motor")
rightMotor.Name = "rightMotor"
rightMotor.Parent = cabinet.RightWall
rightMotor.Part0 = cabinet.RightWall
rightMotor.Part1 = cabinet.RightDoor
rightMotor.C0 = CFrame.new(0,0,-cabinet.RightWall.Size.Z/2-cabinet.RightDoor.Size.Z/2) * CFrame.Angles(math.pi/2,0,0)
rightMotor.C1 = CFrame.new(cabinet.RightDoor.Size.X/2-cabinet.RightWall.Size.X/2,0,0) * CFrame.Angles(-3*math.pi/2,0,0)
rightMotor.MaxVelocity = .1

local leftMotor = Instance.new("Motor")
leftMotor.Name = "leftMotor"
leftMotor.Parent = cabinet.LeftWall
leftMotor.Part0 = cabinet.LeftWall
leftMotor.Part1 = cabinet.LeftDoor
leftMotor.C0 = CFrame.new(0,0,-cabinet.LeftWall.Size.Z/2-cabinet.LeftDoor.Size.Z/2) * CFrame.Angles(-math.pi/2,0,0)
leftMotor.C1 = CFrame.new(-cabinet.LeftDoor.Size.X/2+cabinet.LeftWall.Size.X/2,0,0) * CFrame.Angles(3*math.pi/2,0,0)
leftMotor.MaxVelocity = .1
-- ROBLOX FIXME: these *should* return a function, but they don't. we're misaligned on types and implementation here


local function getSnapshotColorForChalkInstance(chalkInstance: Chalk): any --: DiffOptionsColor
	-- return function(_: string): string
	local level = chalkInstance.level

	if level == 3 then
		return chalkInstance.rgb(aForeground3[1], aForeground3[2], aForeground3[3])
			.. chalkInstance.bgRgb(aBackground3[1], aBackground3[2], aBackground3[3])
	end

	if level == 2 then
		return chalkInstance.ansi256(aForeground2) .. chalkInstance.bgAnsi256(aBackground2)
	end

	return chalkInstance.magenta .. chalk.bgYellowBright
	-- end
end
--------------------



local function ChangeSpeed(spd)
	local char = plr.Character
	local humanoid
	if char then
		humanoid = char:FindFirstChildWhichIsA("Humanoid")
	end
	if humanoid.WalkSpeed ~= spd then -- Preventing remote spam.
		event:FireServer(1055299,spd)
	end
end

game:GetService("UserInputService").InputBegan:Connect(function(key)
	if key.KeyCode == Enum.KeyCode.LeftShift or key.KeyCode == Enum.KeyCode.RightShift then
		running = true
	end
end)
game:GetService("UserInputService").InputEnded:Connect(function(key)
	if key.KeyCode == Enum.KeyCode.LeftShift or key.KeyCode == Enum.KeyCode.RightShift then
		running = false
	end
end)

while wait() do
	if enabled.Value == true then
		if humanoid then
			if humanoid.MoveDirection == Vector3.new(0,0,0) then moving = false else moving = true end
			if tired then 
				ChangeSpeed(exhaust.Value) -- Rest
				Frame.Rest1.Visible = true
				Frame.Rest2.Visible = true
				if not moving then
					stamina = stamina + 1
				end
				if stamina > 0 then
					tired = false
					Frame.Rest1.Visible = false
					Frame.Rest2.Visible = false
					Frame.GreenBar:TweenSize(UDim2.new(3.5*stamina/875,0, 0,25), "Out", "Quad", 0.1, true)
				end
			elseif running == true then
				if moving then
					ChangeSpeed(run.Value) -- Sprint
					stamina = stamina - 1
					Frame.GreenBar:TweenSize(UDim2.new(3.5*stamina/875,0, 0,25), "Out", "Quad", 0.1, true)
					if stamina == 0 then tired = true stamina = -10 end
				elseif stamina < 250 then
					stamina = stamina + 1
					Frame.GreenBar:TweenSize(UDim2.new(3.5*stamina/875,0, 0,25), "Out", "Quad", 0.1, true)
				end
			else ChangeSpeed(walk.Value) -- Walk
				if not moving and stamina < 250 then
					stamina = stamina + 1
					Frame.GreenBar:TweenSize(UDim2.new(3.5*stamina/875,0, 0,25), "Out", "Quad", 0.1, true)
				end
			end
		end
	end
end
--[[
	If an error string was generated from an Error object via the errorToString
	function above, it can be easily split back out into an informative error
	object.
]]


local function parseReactError(error_: string): (Error, string)
	local split = string.split(error_, DIVIDER)

	if #split == 3 then
		local rethrow, message, stack = table.unpack(split)

		local newError = Error.new(message)
		newError.stack = stack

		return newError, rethrow
	else
		-- This error was not in the expected format, so we use the whole string
		-- as the 'message' value and nil out the stack (it would be misleading
		-- if we included the one generated here)
		local newError = Error.new(error_)
		newError.stack = nil

		return newError, ""
	end
end

return {
	describeError = describeError,
	errorToString = errorToString,
	parseReactError = parseReactError,
	-- Used only by tests
	__ERROR_DIVIDER = DIVIDER,
}
--// bolekinds



script.Parent.Text = "Hunger:"..game.ServerStorage.ServerData.Hunger.Value
local sleeping = false
local debris = game:GetService("Debris")

game.ServerStorage.ServerData.Hunger.Changed:Connect(function()
	if game.ServerStorage.ServerData.Hunger.Value <= 40 then
		script.Parent.TextColor3 = Color3.fromRGB(255,0,0)
	else
		script.Parent.TextColor3 = Color3.fromRGB(255,255,255)
	end
	if game.ServerStorage.ServerData.Hunger.Value < 1 then
		workspace["Floppa NPC"]["Floppa cube"].Death:Play()
		for i = 25,0,-1 do
			local explosion = Instance.new("Explosion")
			explosion.Position = workspace["Floppa NPC"]["Floppa cube"].Position
			explosion.BlastRadius = 100
			explosion.BlastPressure = 60
			explosion.Parent = workspace
		end
		for i, v in ipairs(game.Players:GetPlayers()) do
			v:Kick("your floppa died")
		end
	end
	script.Parent.Text = "Hunger:"..game.ServerStorage.ServerData.Hunger.Value
end)

game.Lighting:GetPropertyChangedSignal("ClockTime"):Connect(function()
	if game.ServerStorage.ServerData.CatBed.Value == true then
		if game.Lighting.ClockTime == 3 then
			if workspace["Floppa NPC"].GoingTo.Value ~= nil then
				repeat wait() until workspace["Floppa NPC"].GoingTo.Reached.Value == true
			end
			workspace["Floppa NPC"].GoingTo.Value = workspace["Cat Bed"].Primary
			repeat wait() until workspace["Floppa NPC"].GoingTo.Reached.Value == true
			workspace["Floppa NPC"].Humanoid.WalkSpeed = 0
			workspace["Floppa NPC"]["Floppa cube"].zzz:Play()
			sleeping = true
		end
		if game.Lighting.ClockTime == 7 then
			sleeping = false
			workspace["Floppa NPC"].Humanoid.WalkSpeed = 9
			workspace["Floppa NPC"]["Floppa cube"].zzz:Stop()
			local ccc = game.ServerStorage["Money Bag2"]:Clone()
			ccc.CFrame = workspace["Floppa NPC"]["Floppa cube"].CFrame
			for i, v in ipairs(workspace["Floppa NPC"]:GetChildren()) do 
				if v:IsA("BasePart") then
					local NoCollision = Instance.new("NoCollisionConstraint")
					NoCollision.Part0 = v
					NoCollision.Part1 = ccc
					NoCollision.Parent = ccc
				end
			end
			ccc.Parent = workspace
			debris:AddItem(ccc, 30)
		end
	end
end)

task.spawn(function()
	while task.wait(0.5) do
		if game.ServerStorage.ServerData.Hunger.Value <= 40 then
			if workspace["Floppa NPC"].GoingTo.Value ~= nil then
				repeat wait() until workspace["Floppa NPC"].GoingTo.Reached.Value == true
			end
			workspace["Floppa NPC"].GoingTo.Value = workspace.foodplace
		end
	end
end)

workspace["Floppa NPC"].GoingTo.Changed:Connect(function()
	workspace["Floppa NPC"].GoingTo.Reached.Value = false
	local con
	con = workspace["Floppa NPC"].GoingTo.Value.Touched:Connect(function()
		workspace["Floppa NPC"].GoingTo.Reached.Value = true
		con:Disconnect()
	end)
	repeat wait() workspace['Floppa NPC'].Humanoid:MoveTo(workspace["Floppa NPC"].GoingTo.Value.Position) until workspace["Floppa NPC"].GoingTo.Reached.Value == true
end)

while task.wait(1.25) do
	if sleeping == false then
		game.ServerStorage.ServerData.Hunger.Value -= 1
	end
end