Pinkstack/roblox-luau-corpus-text huggingface dataset:
-- Note: DotProduct check in CoordinateFrame::lookAt() prevents using values within about
-- 8.11 degrees of the +/- Y axis, that's why these limits are currently 80 degrees


local MIN_Y = math.rad(-80)
local MAX_Y = math.rad(80)

local VR_ANGLE = math.rad(15)
local VR_LOW_INTENSITY_ROTATION = Vector2.new(math.rad(15), 0)
local VR_HIGH_INTENSITY_ROTATION = Vector2.new(math.rad(45), 0)
local VR_LOW_INTENSITY_REPEAT = 0.1
local VR_HIGH_INTENSITY_REPEAT = 0.4

local ZERO_VECTOR2 = Vector2.new(0,0)
local ZERO_VECTOR3 = Vector3.new(0,0,0)

local TOUCH_SENSITIVTY = Vector2.new( 0.002 * math.pi, 0.0015 * math.pi)
local MOUSE_SENSITIVITY = Vector2.new( 0.002 * math.pi, 0.0015 * math.pi )

local MAX_TIME_FOR_DOUBLE_TAP = 1.5
local MAX_TAP_POS_DELTA = 15
local MAX_TAP_TIME_DELTA = 0.75

local SEAT_OFFSET = Vector3.new(0,5,0)
local VR_SEAT_OFFSET = Vector3.new(0,4,0)
local HEAD_OFFSET = Vector3.new(0,1.5,0)
local R15_HEAD_OFFSET = Vector3.new(0,2,0)

local bindAtPriorityFlagExists, bindAtPriorityFlagEnabled = pcall(function()
	return UserSettings():IsUserFeatureEnabled("UserPlayerScriptsBindAtPriority")
end)
local FFlagPlayerScriptsBindAtPriority = bindAtPriorityFlagExists and bindAtPriorityFlagEnabled

local newDefaultCameraAngleFlagExists, newDefaultCameraAngleFlagEnabled = pcall(function()
	return UserSettings():IsUserFeatureEnabled("UserNewDefaultCameraAngle")
end)
local FFlagUserNewDefaultCameraAngle = newDefaultCameraAngleFlagExists and newDefaultCameraAngleFlagEnabled

local Util = require(script.Parent:WaitForChild("CameraUtils"))
local ZoomController = require(script.Parent:WaitForChild("ZoomController"))
-- Functions



local function getRotationBetween(u, v, axis)
	local dot, uxv = u:Dot(v), u:Cross(v)
	if (dot < -0.99999) then return CFrame.fromAxisAngle(axis, math.pi) end
	return CFrame.new(0, 0, 0, uxv.x, uxv.y, uxv.z, 1 + dot)
end

local function twistAngle(cf, direction)
    local axis, theta = cf:ToAxisAngle()
    local w, v = math.cos(theta/2),  math.sin(theta/2)*axis
	local proj = v:Dot(direction)*direction
    local twist = CFrame.new(0, 0, 0, proj.x, proj.y, proj.z, w)
    local nAxis, nTheta = twist:ToAxisAngle()
	return math.sign(v:Dot(direction))*nTheta
end
--[[
	Constructs a new computed state object, which follows the value of another
	state object using a spring simulation.
]]



local Package = script.Parent.Parent
local PubTypes = require(Package.PubTypes)
local Types = require(Package.Types)
local logError = require(Package.Logging.logError)
local logErrorNonFatal = require(Package.Logging.logErrorNonFatal)
local unpackType = require(Package.Animation.unpackType)
local SpringScheduler = require(Package.Animation.SpringScheduler)
local useDependency = require(Package.Dependencies.useDependency)
local initDependency = require(Package.Dependencies.initDependency)
local updateAll = require(Package.Dependencies.updateAll)
local xtypeof = require(Package.Utility.xtypeof)
local unwrap = require(Package.State.unwrap)

local class = {}

local CLASS_METATABLE = {__index = class}
local WEAK_KEYS_METATABLE = {__mode = "k"}
-- Convenience function so that calling code does not have to first get the activeController
-- and then call GetMoveVector on it. When there is no active controller, this function returns
-- nil so that this case can be distinguished from no current movement (which returns zero vector).


function ControlModule:GetMoveVector()
	if self.activeController then
		return self.activeController:GetMoveVector()
	end
	return Vector3.new(0,0,0)
end

function ControlModule:GetActiveController()
	return self.activeController
end

function ControlModule:Enable(enable)
	if not self.activeController then
		return
	end
	
	if enable == nil then
		enable = true
	end
	if enable then
		if self.touchControlFrame then
			self.activeController:Enable(true, self.touchControlFrame)
		else
			if self.activeControlModule == ClickToMove then
				-- For ClickToMove, when it is the player's choice, we also enable the full keyboard controls.
				-- When the developer is forcing click to move, the most keyboard controls (WASD) are not available, only spacebar to jump.
				self.activeController:Enable(true, Players.LocalPlayer.DevComputerMovementMode == Enum.DevComputerMovementMode.UserChoice)
			else				
				self.activeController:Enable(true)
			end
		end
	else
		self:Disable()
	end
end
--edit the function below to return true when you want this response/prompt to be valid
--player is the player speaking to the dialogue, and dialogueFolder is the object containing the dialogue data


return function(player, dialogueFolder)
	local plrData = require(game.ReplicatedStorage.Source.Modules.Util):GetPlayerData(player)
	return plrData.Classes.Base.Smasher.XP.Value < 20
end
--[[
		___      _______                _     
	   / _ |____/ ___/ /  ___ ____ ___ (_)__ 
	  / __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-<
	 /_/ |_|   \___/_//_/\_,_/___/___/_/___/
 						SecondLogic @ Inspare
]]




local autoscaling	= false					--Estimates top speed

local UNITS	= {								--Click on speed to change units
											--First unit is default	
	{
		units			= "MPH"				,
		scaling			= (10/12) * (60/88)	, -- 1 stud : 10 inches | ft/s to MPH
		maxSpeed		= 280				,
		spInc			= 20				, -- Increment between labelled notches
	},
	
	{
		units			= "KM/H"			,
		scaling			= (10/12) * 1.09728	, -- 1 stud : 10 inches | ft/s to KP/H
		maxSpeed		= 370				,
		spInc			= 40				, -- Increment between labelled notches
	},
	
	{
		units			= "SPS"				,
		scaling			= 1					, -- Roblox standard
		maxSpeed		= 400				,
		spInc			= 40				, -- Increment between labelled notches
	}
}
-------- OMG HAX



r = game:service("RunService")


local damage = 5


local slash_damage = 12
local lunge_damage = 35

sword = script.Parent.Handle
Tool = script.Parent


local SlashSound = Instance.new("Sound")
SlashSound.SoundId = "rbxasset://sounds\\swordslash.wav"
SlashSound.Parent = sword
SlashSound.Volume = .7

local LungeSound = Instance.new("Sound")
LungeSound.SoundId = "rbxasset://sounds\\swordlunge.wav"
LungeSound.Parent = sword
LungeSound.Volume = .6

local UnsheathSound = Instance.new("Sound")
UnsheathSound.SoundId = "rbxasset://sounds\\unsheath.wav"
UnsheathSound.Parent = sword
UnsheathSound.Volume = 1


function blow(hit)
	local humanoid = hit.Parent:findFirstChild("Humanoid")
	local vCharacter = Tool.Parent
	local vPlayer = game.Players:playerFromCharacter(vCharacter)
	local hum = vCharacter:findFirstChild("Humanoid") -- non-nil if tool held by a character
	if humanoid~=nil and humanoid ~= hum and hum ~= nil then
		-- final check, make sure sword is in-hand

		local right_arm = vCharacter:FindFirstChild("Right Arm")
		if (right_arm ~= nil) then
			local joint = right_arm:FindFirstChild("RightGrip")
			if (joint ~= nil and (joint.Part0 == sword or joint.Part1 == sword)) then
				tagHumanoid(humanoid, vPlayer)
				humanoid:TakeDamage(damage)
				wait(1)
				untagHumanoid(humanoid)
			end
		end


	end
end


function tagHumanoid(humanoid, player)
	local creator_tag = Instance.new("ObjectValue")
	creator_tag.Value = player
	creator_tag.Name = "creator"
	creator_tag.Parent = humanoid
end

function untagHumanoid(humanoid)
	if humanoid ~= nil then
		local tag = humanoid:findFirstChild("creator")
		if tag ~= nil then
			tag.Parent = nil
		end
	end
end


function attack()
	damage = slash_damage
	SlashSound:play()
	local anim = Instance.new("StringValue")
	anim.Name = "toolanim"
	anim.Value = "Slash"
	anim.Parent = Tool
end

function lunge()
	damage = lunge_damage

	LungeSound:play()

	local anim = Instance.new("StringValue")
	anim.Name = "toolanim"
	anim.Value = "Lunge"
	anim.Parent = Tool
	
	
	force = Instance.new("BodyVelocity")
	force.velocity = Vector3.new(0,10,0) --Tool.Parent.Torso.CFrame.lookVector * 80
	force.Parent = Tool.Parent.Torso
	wait(.2)
	swordOut()
	wait(.2)
	force.Parent = nil
	wait(.4)
	swordUp()

	damage = slash_damage
end

function swordUp()
	Tool.GripForward = Vector3.new(-1,0,0)
	Tool.GripRight = Vector3.new(0,1,0)
	Tool.GripUp = Vector3.new(0,0,1)
end

function swordOut()
	Tool.GripForward = Vector3.new(0,0,1)
	Tool.GripRight = Vector3.new(0,1,0)
	Tool.GripUp = Vector3.new(1,0,0)
end

function swordAcross()
	-- parry
end


Tool.Enabled = true
local last_attack = 0
function onActivated()

	if not Tool.Enabled then
		return
	end

	Tool.Enabled = false

	local character = Tool.Parent;
	local humanoid = character.Humanoid
	if humanoid == nil then
		print("Humanoid not found")
		return 
	end

	t = r.Stepped:wait()

	if (t - last_attack < .2) then
		lunge()
	else
		attack()
	end

	last_attack = t

	--wait(.5)

	Tool.Enabled = true
end


function onEquipped()
	UnsheathSound:play()
end


script.Parent.Activated:connect(onActivated)
script.Parent.Equipped:connect(onEquipped)


connection = sword.Touched:connect(blow)
------------------------------------[[PLAYLIST]---------------------------------------------------------------------------------------------------------------------



song1 = "http://www.roblox.com/asset/?id=4924940868" --insert the ID number after the "/?id="
song2 = "http://www.roblox.com/asset/?id=2087798404"
song3 = "http://www.roblox.com/asset/?id=1608398085"
song4 = "http://www.roblox.com/asset/?id=1327798905"
song5 = "http://www.roblox.com/asset/?id=2868925132"
song6 = "http://www.roblox.com/asset/?id=5466929560"
song7 = "http://www.roblox.com/asset/?id=1572404379"
song8 = "http://www.roblox.com/asset/?id=1859222085"
song9 = "http://www.roblox.com/asset/?id=4924940868"
song10 = "http://www.roblox.com/asset/?id=5625100862"
song11 = "http://www.roblox.com/asset/?id=2023642240"
song12 = "http://www.roblox.com/asset/?id=1572323159"
--[[
	CameraModule - This ModuleScript implements a singleton class to manage the
	selection, activation, and deactivation of the current camera controller,
	character occlusion controller, and transparency controller. This script binds to
	RenderStepped at Camera priority and calls the Update() methods on the active
	controller instances.

	The camera controller ModuleScripts implement classes which are instantiated and
	activated as-needed, they are no longer all instantiated up front as they were in
	the previous generation of PlayerScripts.

	2018 PlayerScripts Update - AllYourBlox
--]]



local CameraModule = {}
CameraModule.__index = CameraModule

local FFlagUserRemoveTheCameraApi do
	local success, result = pcall(function()
		return UserSettings():IsUserFeatureEnabled("UserRemoveTheCameraApi")
	end)
	FFlagUserRemoveTheCameraApi = success and result
end
--// Ammo Settings			


	Ammo = 15;
	StoredAmmo = 15;
	MagCount = 8; --  If you want infinate ammo, set to math.huge EX. MagCount = math.huge;
	ExplosiveAmmo = 3;
	
	--// Damage Setting
	BaseDamage = script.Parent.Damage.Value; -- Torso Damage
	LimbDamage = 35; -- Arms and Legs
	ArmorDamage = 35; -- How much damage is dealt against armor (Name the armor "Armor")
	HeadDamage = 60; -- If you set this to 100, there's a chance the player won't die because of the heal script
-- Returns the common parts of the given paths or {} if no
-- common parts were found.


function Path:_commonParts(...: string)
	local common_parts: Array<string> = {}
	local paths: Array<string> = { ... }
	local split_paths = {}
	for _, path in ipairs(paths) do
		table.insert(split_paths, self:_splitBySeparators(path))
	end
	for part_i = 1, #split_paths[1] do
		local test_part = split_paths[1][part_i]
		for path_i = 2, #split_paths do
			local part = split_paths[path_i][part_i]
			if not self:pathsEqual(test_part, part) then
				return common_parts
			end
		end
		table.insert(common_parts, test_part)
	end
	return common_parts
end
-------------------------


 
mouse.KeyDown:connect(function (key)
    key = string.lower(key)
		if key == "k" then --Camera controls
	        if cam == ("car") then
				Camera.CameraSubject = player.Character.Humanoid
				Camera.CameraType = ("Custom")
				cam = ("freeplr")
				Camera.FieldOfView = 70
			elseif cam == ("freeplr") then
				Camera.CameraSubject = player.Character.Humanoid
				Camera.CameraType = ("Attach")
				cam = ("lockplr")
				Camera.FieldOfView = 45
	        elseif cam == ("lockplr") then
				Camera.CameraSubject = carSeat
				Camera.CameraType = ("Custom")
				cam = ("car")
				Camera.FieldOfView = 70
	        end
		elseif key == "[" then -- volume down
			if carSeat.Parent.Body.MP.Sound.Volume >= 0 then
				handler:FireServer('volumedown', true)
				carSeat.Parent.Body.Dash.Screen.G.Main.Icon.Vol.Text = ("Vol: "..carSeat.Parent.MPL.Sound.Volume)
			end
		elseif key == "]" then -- volume up
			if carSeat.Parent.Body.MP.Sound.Volume <= 10 then
				handler:FireServer('volumeup', true)
				carSeat.Parent.Body.Dash.Screen.G.Main.Icon.Vol.Text = ("Vol: "..carSeat.Parent.MPL.Sound.Volume)
			end	
 elseif key == "u" then
					handler:FireServer("Radio")
				elseif key == "g" then
					handler:FireServer("Delete")
				elseif key == "n" then
					handler:FireServer("Tabs")
	end
end)

HUB.Sport.MouseButton1Click:connect(function() --Hide tracker names
	handler:FireServer('Sport')
end)

HUB.Comfort.MouseButton1Click:connect(function() --Hide tracker names
	handler:FireServer('Comfort')
end)

HUB.Dynamic.MouseButton1Click:connect(function() --Hide tracker names
	handler:FireServer('Dynamic')
end)



carSeat.Indicator.Changed:connect(function()
	if carSeat.Indicator.Value == true then
		script.Parent.Indicator:Play()
	else
		script.Parent.Indicator2:Play()
	end
end)

game.Lighting.Changed:connect(function(prop)
	if prop == "TimeOfDay" then
	handler:FireServer('TimeUpdate')
	end
end)

if game.Workspace.FilteringEnabled == true then
	handler:FireServer('feON')
elseif game.Workspace.FilteringEnabled == false then
	handler:FireServer('feOFF')
end

carSeat.LI.Changed:connect(function()
	if carSeat.LI.Value == true then
		carSeat.Parent.Body.Dash.Spd.G.Indicator.Visible = true
		script.Parent.HUB.Left.Visible = true
	else
		carSeat.Parent.Body.Dash.Spd.G.Indicator.Visible = false
		script.Parent.HUB.Left.Visible = false
	end
end)

carSeat.RI.Changed:connect(function()
	if carSeat.RI.Value == true then
		carSeat.Parent.Body.Dash.Tac.G.Indicator.Visible = true
		script.Parent.HUB.Right.Visible = true
	else
		carSeat.Parent.Body.Dash.Tac.G.Indicator.Visible = false
		script.Parent.HUB.Right.Visible = false
	end
end)


while wait() do
	carSeat.Parent.Body.Dash.DashSc.G.Spd.Text = (math.floor(carSeat.Velocity.magnitude*((10/12) * (60/88))).." mph")
	carSeat.Parent.Body.Dash.Screen.G.Screen.StatusBar.Time.Text = game.Lighting.TimeOfDay
	carSeat.Parent.Body.Dash.DashSc2.G.Time.Text = game.Lighting.TimeOfDay
end
--Precalculated paths


local t,f,n=true,false,{}
local r={
[58]={{25,26,27,28,29,31,32,34,35,39,41,30,56,58},t},
[49]={{25,26,27,28,44,45,49},t},
[16]={n,f},
[19]={{25,26,27,28,29,31,32,34,35,39,41,30,56,58,20,19},t},
[59]={{25,26,27,28,29,31,32,34,35,39,41,59},t},
[63]={{25,26,27,28,29,31,32,34,35,39,41,30,56,58,23,62,63},t},
[34]={{25,26,27,28,29,31,32,34},t},
[21]={{25,26,27,28,29,31,32,34,35,39,41,30,56,58,20,21},t},
[48]={{25,26,27,28,44,45,49,48},t},
[27]={{25,26,27},t},
[14]={n,f},
[31]={{25,26,27,28,29,31},t},
[56]={{25,26,27,28,29,31,32,34,35,39,41,30,56},t},
[29]={{25,26,27,28,29},t},
[13]={n,f},
[47]={{25,26,27,28,44,45,49,48,47},t},
[12]={n,f},
[45]={{25,26,27,28,44,45},t},
[57]={{25,26,27,28,29,31,32,34,35,39,41,30,56,57},t},
[36]={{25,26,27,28,29,31,32,33,36},t},
[25]={{25},t},
[71]={{25,26,27,28,29,31,32,34,35,39,41,59,61,71},t},
[20]={{25,26,27,28,29,31,32,34,35,39,41,30,56,58,20},t},
[60]={{25,26,27,28,29,31,32,34,35,39,41,60},t},
[8]={n,f},
[4]={n,f},
[75]={{25,26,27,28,29,31,32,34,35,39,41,59,61,71,72,76,73,75},t},
[22]={{25,26,27,28,29,31,32,34,35,39,41,30,56,58,20,21,22},t},
[74]={{25,26,27,28,29,31,32,34,35,39,41,59,61,71,72,76,73,74},t},
[62]={{25,26,27,28,29,31,32,34,35,39,41,30,56,58,23,62},t},
[1]={n,f},
[6]={n,f},
[11]={n,f},
[15]={n,f},
[37]={{25,26,27,28,29,31,32,33,36,37},t},
[2]={n,f},
[35]={{25,26,27,28,29,31,32,34,35},t},
[53]={{25,26,27,28,44,45,49,48,47,52,53},t},
[73]={{25,26,27,28,29,31,32,34,35,39,41,59,61,71,72,76,73},t},
[72]={{25,26,27,28,29,31,32,34,35,39,41,59,61,71,72},t},
[33]={{25,26,27,28,29,31,32,33},t},
[69]={{25,26,27,28,29,31,32,34,35,39,41,60,69},t},
[65]={{25,26,27,28,29,31,32,34,35,39,41,30,56,58,20,19,66,64,65},t},
[26]={{25,26},t},
[68]={{25,26,27,28,29,31,32,34,35,39,41,30,56,58,20,19,66,64,67,68},t},
[76]={{25,26,27,28,29,31,32,34,35,39,41,59,61,71,72,76},t},
[50]={{25,26,27,28,44,45,49,48,47,50},t},
[66]={{25,26,27,28,29,31,32,34,35,39,41,30,56,58,20,19,66},t},
[10]={n,f},
[24]={{25,24},t},
[23]={{25,26,27,28,29,31,32,34,35,39,41,30,56,58,23},t},
[44]={{25,26,27,28,44},t},
[39]={{25,26,27,28,29,31,32,34,35,39},t},
[32]={{25,26,27,28,29,31,32},t},
[3]={n,f},
[30]={{25,26,27,28,29,31,32,34,35,39,41,30},t},
[51]={{25,26,27,28,44,45,49,48,47,50,51},t},
[18]={n,f},
[67]={{25,26,27,28,29,31,32,34,35,39,41,30,56,58,20,19,66,64,67},t},
[61]={{25,26,27,28,29,31,32,34,35,39,41,59,61},t},
[55]={{25,26,27,28,44,45,49,48,47,52,53,54,55},t},
[46]={{25,26,27,28,44,45,49,48,47,46},t},
[42]={{25,26,27,28,29,31,32,34,35,38,42},t},
[40]={{25,26,27,28,29,31,32,34,35,40},t},
[52]={{25,26,27,28,44,45,49,48,47,52},t},
[54]={{25,26,27,28,44,45,49,48,47,52,53,54},t},
[43]={n,f},
[7]={n,f},
[9]={n,f},
[41]={{25,26,27,28,29,31,32,34,35,39,41},t},
[17]={n,f},
[38]={{25,26,27,28,29,31,32,34,35,38},t},
[28]={{25,26,27,28},t},
[5]={n,f},
[64]={{25,26,27,28,29,31,32,34,35,39,41,30,56,58,20,19,66,64},t},
}
return r
--[=[
	@param instance Instance
	@return RBXScriptConnection
	Attaches the trove to a Roblox instance. Once this
	instance is removed from the game (parent or ancestor's
	parent set to `nil`), the trove will automatically
	clean up.

	:::caution
	Will throw an error if `instance` is not a descendant
	of the game hierarchy.
	:::
]=]


function Trove:AttachToInstance(instance: Instance)
	if self._cleaning then
		error("Cannot call trove:AttachToInstance() while cleaning", 2)
	elseif not instance:IsDescendantOf(game) then
		error("Instance is not a descendant of the game hierarchy", 2)
	end
	return self:Connect(instance.Destroying, function()
		self:Destroy()
	end)
end
--[[
	Returns the height offset from the bottom of a character to the middle of its HumanoidRootPart
--]]



local function getHumanoidRootPartOffset(humanoid: Humanoid)
	local rootPart = humanoid.RootPart
	assert(rootPart, "Humanoid has no RootPart set")

	return (rootPart.Size.Y * 0.5) + humanoid.HipHeight
end

return getHumanoidRootPartOffset
---[[ Fade Out and In Settings ]]


module.ChatWindowBackgroundFadeOutTime = 0.5 --Chat background will fade out after this many seconds.
module.ChatWindowTextFadeOutTime = 30				--Chat text will fade out after this many seconds.
module.ChatDefaultFadeDuration = 0.8
module.ChatShouldFadeInFromNewInformation = true
module.ChatAnimationFPS = 60.0
-- listen for jumping and landing and apply Sway and camera mvoement to the Viewmodel


Humanoid.StateChanged:Connect(function(oldstate, newstate)
	if isFirstPerson == true and IncludeJumpSway == true then -- dont apply camera/Viewmodel changes if we aren't in first person
		if newstate == Enum.HumanoidStateType.Landed then
			-- animate the camera's landing "thump"
			--
			-- tween a dummy cframe value for camera recoil
			local camedit = Instance.new("CFrameValue")
			camedit.Value = CFrame.new(0,0,0)*CFrame.Angles(math.rad(-0.75)*SwaySize,0,0)
			local landedrecoil = TweenService:Create(camedit, TweenInfo.new((0.03*6)/Sensitivity, Enum.EasingStyle.Linear, Enum.EasingDirection.Out), {Value = CFrame.new(0,0,0)}) ; landedrecoil:Play() ; game.Debris:AddItem(landedrecoil, 2)
			landedrecoil.Completed:Connect(function()
				camedit.Value = CFrame.new(0,0,0)*CFrame.Angles(math.rad(0.225)*SwaySize,0,0)
				local landedrecovery = TweenService:Create(camedit, TweenInfo.new((0.03*24)/Sensitivity, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {Value = CFrame.new(0,0,0)}) ; landedrecovery:Play(); game.Debris:AddItem(landedrecovery, 3)
			end)
			-- apply the camera adjustments
			spawn(function()
				for i = 1,60 do
					Camera.CFrame = Camera.CFrame*camedit.Value
					RunService.Heartbeat:Wait()
				end
			end)
			-- animate the jump Sway to make the Viewmodel thump down on landing
			local viewmodelrecoil = TweenService:Create(JumpSwayGoal, TweenInfo.new(0.15/Sensitivity, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {Value = CFrame.new(0,0,0)*CFrame.Angles(-math.rad(5)*SwaySize,0,0)}) ; viewmodelrecoil:Play(); game.Debris:AddItem(viewmodelrecoil, 2)
			viewmodelrecoil.Completed:Connect(function()
				local viewmodelrecovery = TweenService:Create(JumpSwayGoal, TweenInfo.new(0.7/Sensitivity, Enum.EasingStyle.Quart, Enum.EasingDirection.Out), {Value = CFrame.new(0,0,0)}) ; viewmodelrecovery:Play() ; game.Debris:AddItem(viewmodelrecovery, 2)
			end)
		elseif newstate == Enum.HumanoidStateType.Freefall then
			-- animate jump Sway when the Character is falling or jumping
			local viewmodeljump = TweenService:Create(JumpSwayGoal, TweenInfo.new(0.5/Sensitivity, Enum.EasingStyle.Sine), {Value = CFrame.new(0,0,0)*CFrame.Angles(math.rad(7.5)*SwaySize,0,0)}) ; viewmodeljump:Play() ; game.Debris:AddItem(viewmodeljump, 2)
		end	
	end
end)

local ArmCoroutine
-- Get the policy info for the user


local success, result = pcall(PolicyService.GetPolicyInfoForPlayerAsync, PolicyService, player)
if success and result then
	if not result.AreAdsAllowed then
		-- Destroy all Main Portal Template instances on the user's client if ads are not allowed
		mainPortal:Destroy()
		mainImageAdUnit:Destroy()
	end
else
	print("Failed to get policy for player", player.Name, "Exception:", result)
end
-----------------------------------------------| Save Stats |------------------------------------------------------------




local DataStoreService = game:GetService("DataStoreService")
local myDataStore = DataStoreService:GetDataStore("myDataStore")


game.Players.PlayerAdded:Connect(function(player)
	local leaderstats = Instance.new("Folder")
	leaderstats.Name = "leaderstats"
	leaderstats.Parent = player

	local Time = Instance.new("IntValue")
	Time.Name = "Time"
	Time.Parent = leaderstats

	local playerUserId = "Player"..player.UserId

	local data 

	local success, errormessage = pcall(function()
		data = myDataStore:GetAsync(playerUserId) 
	end)


	if success then
		Time.Value = data  
	end

	while wait(1) do
		player.leaderstats.Time.Value = player.leaderstats.Time.Value + 0 --Don't change it or it will make it go up twice
	end
end)

game.Players.PlayerRemoving:Connect(function(player)
	local playerUserId = "Player"..player.UserId

	local data = player.leaderstats.Time.Value

	myDataStore:SetAsync(playerUserId, data)   

end)
--!strict


local PhysicsService = game:GetService("PhysicsService")

local OPT_CREATE_GROUPS = true
local OPT_GROUP_ATTRIBUTE = "CollisionGroup"
local ERR_NO_GROUP = "No %q attribute has been set on %s"

local fmt = string.format

local Util = {}

Util.__index = Util

function Util.new(instance: Instance)
	local self = setmetatable({}, Util)
	
	self._events = {}
	self._target = instance
	self._group = instance:GetAttribute(OPT_GROUP_ATTRIBUTE)
	
	if type(self._group) ~= "string" then
		error(fmt(ERR_NO_GROUP, OPT_GROUP_ATTRIBUTE, instance:GetFullName()), 2)
	end
	
	self:ApplyCollisionGroup()
	
	table.insert(self._events, self._target.DescendantAdded:Connect(function(child)
		if child:IsA("BasePart") then
			self:ApplyCollisionGroupToPart(child::BasePart)
		end
	end))
	
	return self
end

function Util:CreateCollisionGroupIfNotExists()
	if OPT_CREATE_GROUPS == false then
		return
	end
	
	if not PhysicsService:GetCollisionGroupId(self._group) then
		PhysicsService:CreateCollisionGroup(self._group)
	end
end

function Util:ApplyCollisionGroupToPart(part: BasePart)
	PhysicsService:SetPartCollisionGroup(part, self._group)
end

function Util:ApplyCollisionGroup()
	self:CreateCollisionGroupIfNotExists()
	
	if self._target:IsA("BasePart") then
		self:ApplyCollisionGroupToPart(self._target::BasePart)
	else
		for _, child: BasePart in ipairs(self._target:GetDescendants()) do
			if not child:IsA("BasePart") then
				continue
			end
			
			self:ApplyCollisionGroupToPart(child)
		end
	end
end

function Util:Destroy()
	for _, event: RBXScriptConnection in ipairs(self._events) do
		event:Disconnect()
	end
end

return Util