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




sp=script.Parent

damage=10
stuck=false

sp.Touched:connect(function(hit)
	if hit and hit~=nil and sp~=nil and not stuck then
		local ct=sp:FindFirstChild("creator")
		if ct.Value~=nil and ct.Value.Character~=nil then
			if hit.Parent~=ct.Value.Character and hit.Name~="Handle" and hit.Name~="Effect" then
				stuck=true
				local w=Instance.new("Weld")
				w.Part0=hit
				w.Part1=sp
				w.C0=hit.CFrame:toObjectSpace(sp.CFrame)
				w.Parent=sp
				local bf=sp:FindFirstChild("BodyForce")
				if bf then
					bf:remove()
				end
				local sound=sp:FindFirstChild("Sound")
				if sound then
					sound:Play()
				end
				sp.Transparency=1
				local h=hit.Parent:FindFirstChild("Humanoid")
				local t=hit.Parent:FindFirstChild("Torso")
				if h~=nil and t~=nil and h.Health>0 then
					for i,v in ipairs(h:GetChildren()) do
						if v.Name=="creator" then
							v:remove()
						end
					end
					ct:clone().Parent=h
					h:TakeDamage(damage)
				end
				local smoke=sp:FindFirstChild("Smoke")
				if smoke then
					smoke.Enabled=true
					wait(.1)
					if smoke then
						smoke.Enabled=false
					end
				end
				wait(5)
				if sp and sp~=nil and sp.Parent~=nil then
					sp:remove()
				end
			end
		end
	end
end)

while not stuck do
	wait(.5)
	local smoke=sp:FindFirstChild("Smoke")
	if not stuck and smoke then
		sp.Transparency=1
		smoke.Enabled=true
		wait(.3)
		if smoke then
			smoke.Enabled=false
		end
	end
	wait(1.5)
	local smoke=sp:FindFirstChild("Smoke")
	if not stuck and smoke then
		sp.Transparency=0
		smoke.Enabled=true
		wait(.3)
		if smoke then
			smoke.Enabled=false
		end
	end
end
--[[
		Walking NPCs
All points (Point A, B, C, D, and E) must be inside of the model.
You should be able to edit the NPC's looks.
Simply keep the Humanoid, animate, Walk, Head, Torso, and (I think) the legs.
The NPC should  be grouped with the Points
]]

--


local npc = script.Parent

local idleanim = script.Animation1
local runanim = script.RunAnim

local idleanimtrack = npc.AI:LoadAnimation(idleanim)
local runanimtrack = npc.AI:LoadAnimation(runanim)

idleanimtrack:Play()
idleanimtrack.Looped = true
script.Parent.HitBox.Script.Enabled = false

model = script.Parent.Parent
hum = script.Parent.AI
torso = script.Parent.Torso
while true do
	wait(math.random(5,7))
	if model.PointA ~= nil then
		a = model.PointA
		hum:MoveTo(a.Position, a)
		idleanimtrack:Stop()
		script.Parent.Head["Scary Scream"]:Play()
		script.Parent.HitBox.Script.Enabled = true
		runanimtrack:Play()
		repeat
			wait(0.1)
			wait(6)
			script.Parent.Parent:Destroy()
		
		until (a.Position - torso.Position).magnitude <= 5

	else
		print("No Point A.")
	end

end
----------------------------------------------------------------------------------------------------
-----------------=[ RECOIL & PRECISAO ]=------------------------------------------------------------
----------------------------------------------------------------------------------------------------


	,VRecoil = {17,18}				--- Vertical Recoil
	,HRecoil = {5,7}				--- Horizontal Recoil
	,AimRecover = .7				---- Between 0 & 1
	
	,RecoilPunch = .15
	,VPunchBase = 2.75				--- Vertical Punch
	,HPunchBase = 1.35				--- Horizontal Punch
	,DPunchBase = 1 				--- Tilt Punch | useless
	
	,AimRecoilReduction = 5 		--- Recoil Reduction Factor While Aiming (Do not set to 0)
	,PunchRecover = 0.2
	,MinRecoilPower = .5
	,MaxRecoilPower = 3.5
	,RecoilPowerStepAmount = .25
	
	,MinSpread = 1.25				--- Min bullet spread value | Studs
	,MaxSpread = 40					--- Max bullet spread value | Studs
	,AimInaccuracyStepAmount = 0.75
	,WalkMultiplier = 0				--- Bullet spread based on player speed

	,SwayBase = 0.25				--- Weapon Base Sway | Studs
	,MaxSway =	1.5					--- Max sway value based on player stamina | Studs
--local distance = 40



while true do
 wait(pause) --CICLO
 for i= 0, 10/dpf do
  object:SetPrimaryPartCFrame(object:GetPrimaryPartCFrame() * CFrame.new(0, dpf, 0))
  wait(0)
 end
 wait(pause) --CICLO
 for i= 0, 10/dpf do
  object:SetPrimaryPartCFrame(object:GetPrimaryPartCFrame() * CFrame.new(0, -dpf, 0))
  wait(0)
	 end
wait(pause) --CICLO
 for i= 0, 6/dpf do
  object:SetPrimaryPartCFrame(object:GetPrimaryPartCFrame() * CFrame.new(0, dpf, 0))
  wait(0)
	 end
wait(pause) --CICLO
 for i= 0, 6/dpf do
  object:SetPrimaryPartCFrame(object:GetPrimaryPartCFrame() * CFrame.new(0, -dpf, 0))
  wait(0)
	 end
wait(pause) --CICLO
 for i= 0, 8/dpf do
  object:SetPrimaryPartCFrame(object:GetPrimaryPartCFrame() * CFrame.new(0, dpf, 0))
  wait(0)
	 end
wait(pause) --CICLO
 for i= 0, 8/dpf do
  object:SetPrimaryPartCFrame(object:GetPrimaryPartCFrame() * CFrame.new(0, -dpf, 0))
  wait(0)
	 end
end
-- Helper function for Determinant of 3x3, not in CameraUtils for performance reasons


local function Det3x3(a: number,b: number,c: number,d: number,e: number,f: number,g: number,h: number,i: number): nemubr
	return (a*(e*i-f*h)-b*(d*i-f*g)+c*(d*h-e*g))
end
-- Setup animation objects


function scriptChildModified(child)
	local fileList = animNames[child.Name]
	if fileList ~= nil then
		configureAnimationSet(child.Name, fileList)
	end	
end

script.ChildAdded:connect(scriptChildModified)
script.ChildRemoved:connect(scriptChildModified)


for name, fileList in pairs(animNames) do 
	configureAnimationSet(name, fileList)
end
--  Find Player (& who else not to find).


function findNearestTorso(pos)  --  declare pos a local vector3
	local list = game.Workspace:children()
	local torso = nil
	local dist = 1000  -- Area to search
	local temp = nil
	local human = nil
	local temp2 = nil
	for x = 1, #list do
		temp2 = list[x]
		if temp2.className == "Model" then
			temp = temp2:findFirstChild("Torso")
			if temp ~= nil then
				human = temp2:findFirstChild("Humanoid")
				if human ~= nil and (human.Health > 0) and (temp2.Name ~= AIName) then -- not named the same as us.
					if (temp.Position - pos).magnitude < dist then
						torso = temp
						dist = (temp.Position - pos).magnitude
					end  --  closer?
				end   --  human? Not us. 
			end -- Has torso?
		end   --  Model? 
	end  --  For. Loop thru parts in Workplace

	return torso
end  -- findNearest


function DrawRay(origin, point)  -- 7 studs long
	local Ray = Ray.new(origin, (point).unit * 7) --Make the ray.
	local Hit,Position = game.Workspace:FindPartOnRay(Ray,AI) --Check for collisions along the ray, ignoring any Parts of us.

if GraphicsOn then --Graphics
	local RayPart = Instance.new("Part",AI)
	if Hit then
		if Logic == 1 then
			RayPart.BrickColor = BrickColor.new("Black") --Set its color.
		else
			RayPart.BrickColor = BrickColor.new("Bright red") --Set its color.
		end
	else
		if Logic == 1 then
			RayPart.BrickColor = BrickColor.new("White") --Set its color.
		else
			RayPart.BrickColor = BrickColor.new("Olive") --Set its color.
		end
	end
	RayPart.Transparency = 0.2 --Set its transparency.
	RayPart.Anchored = true --Set whether it will fall or not.
	RayPart.CanCollide = false --Set whether people can walk though it or not.	
   RayPart.formFactor = Enum.FormFactor.Custom --Make it so it can be small.
local Distance = (Position-origin).magnitude --Find the distance between the hit and the torso.
	RayPart.Size = Vector3.new(0.4,.2,Distance) --Set its size to the distance.
	RayPart.CFrame = CFrame.new(Position, origin) * CFrame.new(0,0,-Distance/2) --Move it halfway.
	game.Debris:AddItem(RayPart,2) --Add it to the debris.
end -- Graphics

return Hit
end -- DrawRay


function FireRayToward() -- possible path, and read the Part we hit, if any.
 ClimbingLadder = false

local originPrime = origin * Vector3.new(.8,0,0) - Vector3.new(0,.4,0) -- Offset Right + OffY
local offset = origin * Vector3.new(.8,0,0) - origin * Vector3.new(-.8,0,0) -- left (I guess this is increment. I didn't WANT to do it this way)
local point = origin.lookVector * 7 -- dir
local pointPrime = point - offset + Vector3.new(0,2,0)  -- dir + OffsetLeft + OffsetY = direction of Ray

local	Hit = DrawRay(originPrime, pointPrime) -- see if we hit anything

	if Hit then
 
		if target.Parent == Hit.Parent then
--------------------mods



local ModTable = {

	camRecoilMod 	= {
		RecoilTilt 	= 1,
		RecoilUp 	= 1,
		RecoilLeft 	= 1,
		RecoilRight = 1
	}

	,gunRecoilMod	= {
		RecoilUp 	= 1,
		RecoilTilt 	= 1,
		RecoilLeft 	= 1,
		RecoilRight = 1
	}

	,ZoomValue 		= 70
	,Zoom2Value 	= 70
	,AimRM 			= 1
	,SpreadRM 		= 1
	,DamageMod 		= 1
	,minDamageMod 	= 1

	,MinRecoilPower 			= 1
	,MaxRecoilPower 			= 1
	,RecoilPowerStepAmount 		= 1

	,MinSpread 					= 1
	,MaxSpread 					= 1					
	,AimInaccuracyStepAmount 	= 1
	,AimInaccuracyDecrease 		= 1
	,WalkMult 					= 1
	,adsTime 					= 1		
	,MuzzleVelocity 			= 1
}
--	local rocket = pos:Clone() -- создаём клон
--	rocket.Parent = game.Workspace
--	rocket.Name = "bullet" -- pos.Parent.Name
--	Debris :AddItem(rocket, 10) -- уничтожение по истечении таймера сколько проживёт снаряд


	 -- добавляем переменную с повреждением
	local dam	= Instance.new("IntValue")
	dam.Name	= "Damage"
	dam.Parent	= rocket
	dam.Value	= damage
	 -- добавляем переменную скорости
	local spd	= Instance.new("IntValue")
	spd.Name	= "Speed"
	spd.Parent	= rocket
	spd.Value	= speed
	 -- добавляем переменную типа
	local tpt	= Instance.new("StringValue")
	tpt.Name	= "Type"
	tpt.Parent	= rocket
	tpt.Value	= Type
	 -- добавляем переменную хозяина
	if pos:FindFirstChild("Owner") ~= nil then 
		if rocket:FindFirstChild("Owner") == nil then
			local own	= pos.Owner:Clone()
			own.Parent	= rocket
		end	
	end
	-- вешаем на него скрипт полёта, соприкосновения и активируем
	local scr	= script.bullet:Clone()
	scr.Parent	= rocket
	scr.Name	= "bullet"
--[[Config = require(script.Parent.Parent.Parent.Parent.Parent.CustomLabel)
CustomLabel = Config["CUSTOMFLOORLABEL"][tonumber(script.Parent.Parent.Name)]
script.Parent.SurfaceGui.Frame.TextLabel.Text = CustomLabel or script.Parent.Parent.Name]]



while true do
	script.Parent.SurfaceGui.Frame.TextLabel.TextColor3 = script.Parent.Parent.Light.Color
	if script.Parent.Parent.Light.Material == Enum.Material.Neon then
		script.Parent.SurfaceGui.LightInfluence = 0
	else
		script.Parent.SurfaceGui.LightInfluence = 1
	end
	wait()
end
--------------------[ CAMERA STEADYING FUNCTIONS ]------------------------------------



function steadyCamera()
	scopeSteady.Text = "Steadying..."
	scopeSteady.TextColor3 = Color3.new(1, 1, 0)
	camSteady = true
	local originalSway = camSway
	local Increment = 1.5 / 0.6
	local X = 0
	while true do
		RS.RenderStepped:wait()
		local newX = X + Increment
		X = (newX > 90 and 90 or newX)
		if (not steadyKeyPressed) then break end
		camSway = numLerp(originalSway, 0, Sine(X))
		if X == 90 then break end
	end
	while steadyKeyPressed and Aimed do
		if currentSteadyTime > 0 then
			local NewSteadyTime = currentSteadyTime - 1
			currentSteadyTime = (NewSteadyTime < 0 and 0 or NewSteadyTime)
			camSway = 0
		elseif currentSteadyTime == 0 then
			break
		end
		RS.RenderStepped:wait()
	end
	camSteady = false
	spawn(function()
		local Increment = 1.5 / 0.25
		local X = 0
		while true do
			RS.RenderStepped:wait()
			local newX = X + Increment
			X = (newX > 90 and 90 or newX)
			if camSteady then break end
			camSway = numLerp(0, S.scopeSettings.camSwayOnBreath, 1 - COS(RAD(X)))
			if X == 90 then break end
		end
		Increment = 1.5 / S.scopeSettings.breathTime
		X = 0
		while true do
			RS.RenderStepped:wait()
			local newX = X + Increment
			X = (newX > 90 and 90 or newX)
			if camSteady then break end
			camSway = numLerp(S.scopeSettings.camSwayOnBreath, 1, Sine(X))
			if X == 90 then break end
		end
		--[[for X = 0, 90, 1.5 / 0.2 do
			local Alpha = 1 - COS(RAD(X))--math.log10(X) / math.log10(90)
			camSway = numLerp(0, 3, Alpha)
			RS.RenderStepped:wait()
		end]]
		--[[for X = 0, 90, 1.5 / S.scopeSettings.steadyTime do
			if camSteady then break end
			local Alpha = SIN(RAD(X))
			camSway = numLerp(3, 1, Alpha)
			RS.RenderStepped:wait()
		end]]
	end)
	retakeBreath()
end

function retakeBreath()
	scopeSteady.Text = "Re-taking Breath"
	scopeSteady.TextColor3 = Color3.new(1, 0, 0)
	takingBreath = true
	local Increment = S.scopeSettings.steadyTime / S.scopeSettings.breathTime
	while takingBreath do
		if currentSteadyTime < maxSteadyTime then
			local newSteadyTime = currentSteadyTime + Increment
			currentSteadyTime = (newSteadyTime > maxSteadyTime and maxSteadyTime or newSteadyTime)
		elseif currentSteadyTime >= maxSteadyTime then
			break
		end
		RS.RenderStepped:wait()
	end
	if takingBreath then
		scopeSteady.Text = "Hold "..convertKey(S.Keys.scopeSteady).." to Steady"
		scopeSteady.TextColor3 = Color3.new(1, 1, 0)
		takingBreath = false
	end
end
---- setup emote chat hook


game:GetService("Players").LocalPlayer.Chatted:connect(function(msg)
	local emote = ""
	if msg == "/e dance" then
		emote = dances[math.random(1, #dances)]
	elseif (string.sub(msg, 1, 3) == "/e ") then
		emote = string.sub(msg, 4)
	elseif (string.sub(msg, 1, 7) == "/emote ") then
		emote = string.sub(msg, 8)
	end
	
	if (pose == "Standing" and emoteNames[emote] ~= nil) then
		playAnimation(emote, 0.1, Humanoid)
	end

end)
-- Trying to clone something with Archivable=false will return nil for some reason
-- Helper function to enable Archivable, clone, reset Archivable to what it was before
-- and then return the clone


function safeClone(instance)
	local oldArchivable = instance.Archivable
	
	instance.Archivable = true
	local clone = instance:Clone()
	instance.Archivable = oldArchivable
	
	return clone
end

function characterAdded(player, character)
	player.CharacterAppearanceLoaded:wait()
	wait(0.1)
	
	local humanoid = character:FindFirstChildOfClass("Humanoid")
	buildRagdoll(humanoid)
end

function characterRemoving(character)
	local humanoid = character:FindFirstChildOfClass("Humanoid")
	if humanoid:GetState() ~= Enum.HumanoidStateType.Dead then
		return
	end

	local clone = safeClone(character)
	local cloneHumanoid = clone:FindFirstChildOfClass("Humanoid")

	-- Don't clutter the game with nameplates / healthbars
	cloneHumanoid.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None
	-- Roblox will try to rebuild joints when the clone is parented to Workspace and
	-- break the ragdoll, so disable automatic scaling to prevent that. We don't need
	-- it anyway since the character is already scaled from when it was originally created
	cloneHumanoid.AutomaticScalingEnabled = false
	
	-- Clean up junk so we have less scripts running and don't have ragdolls
	-- spamming random sounds
	local animate = character:FindFirstChild("Animate")
	local sound = character:FindFirstChild("Sound")
	local health = character:FindFirstChild("Health")
	
	if animate then
		animate:Destroy()
	end
	if sound then
		sound:Destroy()
	end
	if health then
		health:Destroy()
	end
	
	clone.Parent = workspace
	
	-- State is not preserved when cloning. We need to set it back to Dead or the
	-- character won't ragdoll. This has to be done AFTER parenting the character
	-- to Workspace or the state change won't replicate to clients that can then
	-- start simulating the character if they get close enough
	cloneHumanoid:ChangeState(Enum.HumanoidStateType.Dead)
end

function playerAdded(player)
	player.CharacterAdded:connect(function(character)
		characterAdded(player, character)
	end)
	
	player.CharacterRemoving:Connect(characterRemoving)
	
	if player.Character then
		characterAdded(player, player.Character)
	end
end

Players.PlayerAdded:connect(playerAdded)
--while wait(59) do
--	pcall(function()
--		local allPlayers = players:GetChildren()
--		for i = 1,#allPlayers,1 do
--			if allPlayers[i] ~= nil then
--				local playersMoneyChild = playerMoney:FindFirstChild(allPlayers[i].Name)
--				if playersMoneyChild then
--					PlayerStatManager:saveStat(allPlayers[i], "Money", playersMoneyChild.Value)
--				end
--			end
--		end
--	end)
--end
--Event


ClickDetector.MouseClick:Connect(function()
	if ClickReady.Value == true then
		ClickReady.Value = false
		ButtonClick:Play()
		Button.Size = Size1
		Button.Material = Material1
		DigitNumber.Value = DigitNumber.Value - 1
		if DigitNumber.Value < Min then
			DigitNumber.Value = Max
		end
		NumberGUI.Text = DigitNumber.Value
		EnteredCode.Value = tostring(Digit1.Value)..""..tostring(Digit2.Value)..""..tostring(Digit3.Value)
		wait(.5)
		Button.Size = Size0
		Button.Material = Material0
		wait(.25)
		ClickReady.Value = true
	end
end)
--[[

yea i script howd u know

]]


repeat wait() until script.Parent.Parent == game:GetService("Players").LocalPlayer.Character
local remote = script.Parent:FindFirstChild("getMouse")
game:GetService("Players").LocalPlayer:GetMouse().Button1Down:Connect(function()
	if game.Players.LocalPlayer.Character:FindFirstChild("Pebble") then
		remote:InvokeServer({Hit=game.Players.LocalPlayer:GetMouse().Hit}, nil)
	end
end)
--- Update all players every second


coroutine.wrap(function()
	--- Loop
	while true do
		--- Wait
		wait(1)
		
		--- Scan through all players
		for _, player in ipairs(game.Players:GetPlayers()) do
			--- Wrap in pcall just in case :/
			pcall(function()
				if player then
					--- Check player
					CheckPlayer(player)
				end
			end)
		end
	end
end)()
--[[
	This is a test file to demonstrate how ragdolls work. If you don't use
	this file, you need to manually apply the Ragdoll tag to humanoids that
	you want to ragdoll
--]]



local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local StarterPlayer = game:GetService("StarterPlayer")

script.KillScript.Parent = StarterPlayer.StarterCharacterScripts
script.RagdollMe.Parent = StarterPlayer.StarterCharacterScripts
--[[ Constants ]]

--
local movementKeys = {
	[Enum.KeyCode.W] = true;
	[Enum.KeyCode.A] = true;
	[Enum.KeyCode.S] = true;
	[Enum.KeyCode.D] = true;
	[Enum.KeyCode.Up] = true;
	[Enum.KeyCode.Down] = true;
}

local FFlagUserNavigationClickToMoveSkipPassedWaypointsSuccess, FFlagUserNavigationClickToMoveSkipPassedWaypointsResult = pcall(function() return UserSettings():IsUserFeatureEnabled("UserNavigationClickToMoveSkipPassedWaypoints") end)
local FFlagUserNavigationClickToMoveSkipPassedWaypoints = FFlagUserNavigationClickToMoveSkipPassedWaypointsSuccess and FFlagUserNavigationClickToMoveSkipPassedWaypointsResult

local Player = Players.LocalPlayer

local ClickToMoveDisplay = require(script.Parent:WaitForChild("ClickToMoveDisplay"))

local ZERO_VECTOR3 = Vector3.new(0,0,0)
local ALMOST_ZERO = 0.000001
--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.Coffee -- 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)
-- Define each RemoteEvent individually


local SpawnSegway = RemoteFolder:WaitForChild("SpawnSegway") -- Spawning segway
local ConfigTool = RemoteFolder:WaitForChild("ConfigTool") -- Coloring segway
local DestroySegway = RemoteFolder:WaitForChild("DestroySegway") -- Coloring segway
local PlaySound = RemoteFolder:WaitForChild("PlaySound")
local StopSound = RemoteFolder:WaitForChild("StopSound")
local AnchorSegway = RemoteFolder:WaitForChild("AnchorSegway")
local UndoTags = RemoteFolder:WaitForChild("UndoTags")
local UndoHasWelded = RemoteFolder:WaitForChild("UndoHasWelded")
local DeleteWelds = RemoteFolder:WaitForChild("DeleteWelds")
local ConfigHumanoid = RemoteFolder:WaitForChild("ConfigHumanoid")
local ConfigLights = RemoteFolder:WaitForChild("ConfigLights")
-- Directions of positioning adjustment for each handle's dragged face


local AxisPositioningMultipliers = {
	[Enum.NormalId.Top] = Vector3.new(0, 1, 0);
	[Enum.NormalId.Bottom] = Vector3.new(0, -1, 0);
	[Enum.NormalId.Front] = Vector3.new(0, 0, -1);
	[Enum.NormalId.Back] = Vector3.new(0, 0, 1);
	[Enum.NormalId.Left] = Vector3.new(-1, 0, 0);
	[Enum.NormalId.Right] = Vector3.new(1, 0, 0);
};
-- Main


local StringUtil = {}

function StringUtil.getReadLength(length: number): number
	return 5
end

function StringUtil.condenseText(str: string): string
	local finalStr: string = ""

	local isMarkdown: boolean = false

	local i = 0
	while i < #str do
		i += 1

		local currentChar: string = string.sub(str, i, i)

		if currentChar == "<" then
			isMarkdown = true
			continue
		elseif currentChar == ">" then
			isMarkdown = false
			continue
		elseif isMarkdown then
			continue
		end

		local wasEscapeCharacter: boolean = false

		if currentChar == "&" then
			-- Suspected as escape character.
			for j = i, #str do
				if string.sub(str, j, j) == ";" then
					local suspectedEscape: string = string.sub(str, i, j)

					for _, pattern: { string } in RICH_TEXT_ESCAPE_CHARACTERS do
						if suspectedEscape == pattern[1] then
							-- move i to j (end of escape character)
							i = j
							finalStr ..= pattern[2]

							wasEscapeCharacter = true
							break
						end
					end
					break
				end
			end
		end

		if not wasEscapeCharacter then
			finalStr ..= currentChar
		end
	end

	return finalStr
end

function StringUtil.countCharacters(str: string): number
	return #StringUtil.condenseText(str)
end

return StringUtil
-- (Hat Giver Script - Loaded.)



debounce = true

function onTouched(hit)
	if (hit.Parent:findFirstChild("Humanoid") ~= nil and debounce == true) then
		debounce = false
		h = Instance.new("Hat")
		p = Instance.new("Part")
		h.Name = "Handle"
		p.Parent = h
		p.Position = hit.Parent:findFirstChild("Head").Position
		p.Name = "Handle" 
		p.formFactor = 0
		p.Size = Vector3.new(1,1,1) 
		p.BottomSurface = 0 
		p.TopSurface = 0 
		p.Locked = true 
		script.Parent.Mesh:clone().Parent = p
		h.Parent = hit.Parent
		h.AttachmentPos = Vector3.new(0,0.35, 0)
		wait(5)
		debounce = true
	end
end

script.Parent.Touched:connect(onTouched)