Pinkstack/roblox-luau-corpus-text huggingface dataset:
--By Luckymaxer



r = game:service("RunService")

local damage = 1

local slash_damage = 5

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

local SlashSound = sword:WaitForChild("SlashSound")

function blow(hit)
	if not hit or not hit.Parent then
		return
	end
	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.Health > 0 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)
				if humanoid.Health == 0 then
					for i, v in pairs(humanoid.Parent:GetChildren()) do
						if v:IsA("BasePart") then
							for ii = 1, 2 do
								local Wood = Instance.new("Part")
								Wood.Name = "Wood"
								Wood.Locked = true
								Wood.CanCollide = true
								Wood.Anchored = false
								Wood.FormFactor = Enum.FormFactor.Custom
								Wood.TopSurface = Enum.SurfaceType.Smooth
								Wood.BottomSurface = Enum.SurfaceType.Smooth
								Wood.Size = Vector3.new(1, 0.8, 1)
								Wood.Material = Enum.Material.Wood
								Wood.BrickColor = BrickColor.new("Dark orange")
								game:GetService("Debris"):AddItem(Wood, 5)
								Wood.Parent = game:GetService("Workspace")
								Wood.CFrame = v.CFrame + Vector3.new(0, (ii * Wood.Size.y), 0)
								v:Destroy()
							end

						end
					end
				end
			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

	game.Debris:AddItem(creator_tag, 1)

end


function attack()
	damage = slash_damage
	SlashSound:play()
	local anim = Instance.new("StringValue")
	anim.Name = "toolanim"
	anim.Value = "Slash"
	anim.Parent = Tool
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()

	attack()

	last_attack = t

	--wait(.5)

	Tool.Enabled = true
end

function onEquipped()
end

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

connection = sword.Touched:connect(blow)
--[[
	
	CameraShakePresets.Bump
	CameraShakePresets.Explosion
	CameraShakePresets.Earthquake
	CameraShakePresets.BadTrip
	CameraShakePresets.HandheldCamera
	CameraShakePresets.Vibration
	CameraShakePresets.RoughDriving
	
--]]





local CameraShakeInstance = require(script.Parent.CameraShakeInstance)

local CameraShakePresets = {
	
	
	-- A high-magnitude, short, yet smooth shake.
	-- Should happen once.
	Bump = function()
		local c = CameraShakeInstance.new(2.5, 4, 0.1, 0.75)
		c.PositionInfluence = Vector3.new(0.15, 0.15, 0.15)
		c.RotationInfluence = Vector3.new(1, 1, 1)
		return c
	end;
	
	
	-- An intense and rough shake.
	-- Should happen once.
	Explosion = function()
		local c = CameraShakeInstance.new(5, 10, 0, 1.5)
		c.PositionInfluence = Vector3.new(0.75, 0.75, 0.75)
		c.RotationInfluence = Vector3.new(6, 3, 3)
		return c
	end;
	
	
	-- A continuous, rough shake
	-- Sustained.
	Earthquake = function()
		local c = CameraShakeInstance.new(0.6, 3.5, 2, 10)
		c.PositionInfluence = Vector3.new(0.25, 0.25, 0.25)
		c.RotationInfluence = Vector3.new(1, 1, 4)
		return c
	end;
	
	
	-- A bizarre shake with a very high magnitude and low roughness.
	-- Sustained.
	BadTrip = function()
		local c = CameraShakeInstance.new(10, 0.15, 5, 10)
		c.PositionInfluence = Vector3.new(0, 0, 0.15)
		c.RotationInfluence = Vector3.new(2, 1, 4)
		return c
	end;
	
	
	-- A subtle, slow shake.
	-- Sustained.
	HandheldCamera = function()
		local c = CameraShakeInstance.new(1, 0.25, 5, 10)
		c.PositionInfluence = Vector3.new(0, 0, 0)
		c.RotationInfluence = Vector3.new(1, 0.5, 0.5)
		return c
	end;
	
	
	-- A very rough, yet low magnitude shake.
	-- Sustained.
	Vibration = function()
		local c = CameraShakeInstance.new(0.4, 20, 2, 2)
		c.PositionInfluence = Vector3.new(0, 0.15, 0)
		c.RotationInfluence = Vector3.new(1.25, 0, 4)
		return c
	end;
	
	
	-- A slightly rough, medium magnitude shake.
	-- Sustained.
	RoughDriving = function()
		local c = CameraShakeInstance.new(1, 2, 1, 1)
		c.PositionInfluence = Vector3.new(0, 0, 0)
		c.RotationInfluence = Vector3.new(1, 1, 1)
		return c
	end;
	
	
}


return setmetatable({}, {
	__index = function(t, i)
		local f = CameraShakePresets[i]
		if (type(f) == "function") then
			return f()
		end
		error("No preset found with index \"" .. i .. "\"")
	end;
})
-- Preload animations


function playAnimation(animName, transitionTime, humanoid)
	if (animName ~= currentAnim) then		 
		
		if (oldAnimTrack ~= nil) then
			oldAnimTrack:Stop()
			oldAnimTrack:Destroy()
		end

		local roll = math.random(1, animTable[animName].totalWeight) 
		local origRoll = roll
		local idx = 1
		while (roll > animTable[animName][idx].weight) do
			roll = roll - animTable[animName][idx].weight
			idx = idx + 1
		end
--Rescripted by Luckymaxer



Tool = script.Parent
Handle = Tool:WaitForChild("Handle")

Players = game:GetService("Players")

Gravity = 196.20
JumpHeightPercentage = 0.25

ToolEquipped = false

local ToolUnequipped, DescendantAdded, DescendantRemoving;

function GetAllConnectedParts(Object)
	local Parts = {}
	local function GetConnectedParts(Object)
		for i, v in pairs(Object:GetConnectedParts()) do
			local Ignore = false
			for ii, vv in pairs(Parts) do
				if v == vv then
					Ignore = true
				end
			end
			if not Ignore then
				table.insert(Parts, v)
				GetConnectedParts(v)
			end
		end
	end
	GetConnectedParts(Object)
	return Parts
end

function SetGravityEffect()
	if not GravityEffect or not GravityEffect.Parent then
		GravityEffect = Instance.new("BodyForce")
		GravityEffect.Name = "GravityCoilEffect"
		GravityEffect.Parent = Torso
	end
	local TotalMass = 0
	local ConnectedParts = GetAllConnectedParts(Torso)
	for i, v in pairs(ConnectedParts) do
		if v:IsA("BasePart") then
			TotalMass = (TotalMass + v:GetMass())
		end
	end
	local TotalMass = (TotalMass * 196.20 * (1 - JumpHeightPercentage))
	GravityEffect.force = Vector3.new(0, TotalMass, 0)
end

function HandleGravityEffect(Enabled)
	if not CheckIfAlive() then
		return
	end
	for i, v in pairs(Torso:GetChildren()) do
		if v:IsA("BodyForce") then
			v:Destroy()
		end
	end
	for i, v in pairs({ToolUnequipped, DescendantAdded, DescendantRemoving}) do
		if v then
			v:disconnect()
		end
	end
	if Enabled then
		CurrentlyEquipped = true
		ToolUnequipped = Tool.Unequipped:connect(function()
			CurrentlyEquipped = false
		end)
		SetGravityEffect()
		DescendantAdded = Character.DescendantAdded:connect(function()
			wait()
			if not CurrentlyEquipped or not CheckIfAlive() then
				return
			end
			SetGravityEffect()
		end)
		DescendantRemoving = Character.DescendantRemoving:connect(function()
			wait()
			if not CurrentlyEquipped or not CheckIfAlive() then
				return
			end
			SetGravityEffect()
		end)
	end
end

function CheckIfAlive()
	return (((Character and Character.Parent and Humanoid and Humanoid.Parent and Humanoid.Health > 0 and Torso and Torso.Parent and Player and Player.Parent) and true) or false)
end

function Equipped(Mouse)
	Character = Tool.Parent
	Humanoid = Character:FindFirstChild("Humanoid")
	Torso = Character:FindFirstChild("Torso")
	Player = Players:GetPlayerFromCharacter(Character)
	if not CheckIfAlive() then
		return
	end
	if HumanoidDied then
		HumanoidDied:disconnect()
	end
	HumanoidDied = Humanoid.Died:connect(function()
		if GravityEffect and GravityEffect.Parent then
			GravityEffect:Destroy()
		end
	end)
	HandleGravityEffect(true)
	ToolEquipped = true
end

function Unequipped()
	if HumanoidDied then
		HumanoidDied:disconnect()
	end
	HandleGravityEffect(false)
	ToolEquipped = false
end

Tool.Equipped:connect(Equipped)
Tool.Unequipped:connect(Unequipped)
-- setup emote chat hook
--[[Game.Players.LocalPlayer.Chatted:connect(function(msg)
	local emote = ""
	if (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
--	print("===> " .. string.sub(msg, 1, 3) .. "(" .. emote .. ")")
end)
]]
--


wait(1)
	powerlmp.Value = true

function Alert()
	script.Parent.Assembly.Sound.Click:Play()
script.AttackScript.Disabled = true
script.Parent.Parent.On.Value = true
end

function Fire()
	script.Parent.Assembly.Sound.Click:Play()
	script.Parent.Parent.On.Value = true	
	script.Parent.Values.Fire.Value = true
end

function Test()
script.Parent.Assembly.Sound.Click:Play()
script.AttackScript.Disabled = true
script.Parent.Parent.On.Value = true
end

	function Attack()
	script.AttackScript.Disabled = false
end


		function Cancel()
			script.Parent.Assembly.Sound.Click:Play()
	script.AttackScript.Disabled = true
	script.Parent.Values.Fire.Value = false
		script.Parent.Values.Mode.Value = 4
		script.Parent.Parent.On.Value = false
		script.Parent.Values.TimerOn.Value = false
end


function Timer()
script.Timer.Disabled = false
signallmp.Value = true
end

		script.Parent.Values.TimerOn.Changed:connect(function()
	if script.Parent.Values.TimerOn.Value == true then
if script.Parent.Values.Mode.Value == 2 then
Alert()
Timer()
elseif script.Parent.Values.Mode.Value == 3 then
Attack()
Timer()
elseif script.Parent.Values.Mode.Value == 5 then
Fire()
Timer()			
elseif script.Parent.Values.Mode.Value == 1 then
Test()
elseif script.Parent.Values.Mode.Value == 4 then
script.AttackScript.Disabled = true
Cancel()
				end
		end
end)


script.Parent.Values.Mode.Changed:connect(function()
if script.Parent.Values.Mode.Value == 4 then
Cancel()
end
end)

script.Parent.Values.Fire.Changed:connect(function()
if script.Parent.Values.Fire.Value == true then
script.Parent.Parent.Parent.FederalSignalRCM3.Modulate.Value = true
else
script.Parent.Parent.Parent.FederalSignalRCM3.Modulate.Value = false
end
end)
--[=[
	@prop Stopped Signal
	@within Component

	Fired when an instance of a component is stopped.

	```lua
	local MyComponent = Component.new({Tag = "MyComponent"})

	MyComponent.Stopped:Connect(function(component) end)
	```
]=]



local CollectionService = game:GetService("CollectionService")
local RunService = game:GetService("RunService")

local Signal = require(script.Parent.Signal)
local Trove = require(script.Parent.Trove)

local IS_SERVER = RunService:IsServer()
local DEFAULT_ANCESTORS = {workspace, game:GetService("Players")}


local renderId = 0
local function NextRenderName(): string
	renderId += 1
	return "ComponentRender" .. tostring(renderId)
end


local function InvokeExtensionFn(component, fnName: string)
	for _,extension in ipairs(component._activeExtensions) do
		local fn = extension[fnName]
		if type(fn) == "function" then
			fn(component)
		end
	end
end


local function ShouldConstruct(component): boolean
	for _,extension in ipairs(component._activeExtensions) do
		local fn = extension.ShouldConstruct
		if type(fn) == "function" then
			local shouldConstruct = fn(component)
			if not shouldConstruct then
				return false
			end
		end
	end
	return true
end


local function GetActiveExtensions(component, extensionList)
	local activeExtensions = table.create(#extensionList)
	local allActive = true
	for _,extension in ipairs(extensionList) do
		local fn = extension.ShouldExtend
		local shouldExtend = type(fn) ~= "function" or not not fn(component)
		if shouldExtend then
			table.insert(activeExtensions, extension)
		else
			allActive = false
		end
	end
	return if allActive then extensionList else activeExtensions
end
--//Shifting//-



if key == "u" then
	if script.Parent.IsOn.Value == true then
	script.Parent.IsOn.Value = false
	

		for index, child in pairs(carSeat.Body.ExhaustSmoke.E1:GetChildren()) do
  		child.Enabled = false
		end	
			for index, child in pairs(carSeat.Body.ExhaustSmoke.E2:GetChildren()) do
  		child.Enabled = false
			end	
			for index, child in pairs(carSeat.Body.ExhaustSmoke.E3:GetChildren()) do
  		child.Enabled = false
		end	
			for index, child in pairs(carSeat.Body.ExhaustSmoke.E4:GetChildren()) do
  		child.Enabled = false
			end
carSeat.DriveSeat.Start1:Stop()
carSeat.DriveSeat.Start2:Stop()
carSeat.DriveSeat.Rev:Stop()
carSeat.DriveSeat.Rev2:Stop()
carSeat.DriveSeat.Idle:Stop()
carSeat.DriveSeat.Idle2:Stop()
else
script.Parent.IsOn.Value = true


		for index, child in pairs(carSeat.Body.ExhaustSmoke.E1:GetChildren()) do
  		child.Enabled = true
		end	
			for index, child in pairs(carSeat.Body.ExhaustSmoke.E2:GetChildren()) do
  		child.Enabled = true

carSeat.DriveSeat.Start1:Play()
carSeat.DriveSeat.Start2:Play()
		end	
wait(2.5)
carSeat.DriveSeat.Idle:Play()
carSeat.DriveSeat.Idle2:Play()
carSeat.DriveSeat.Idle3:Play()
carSeat.DriveSeat.Idle4:Play()
		for index, child in pairs(carSeat.Body.ExhaustSmoke.E1:GetChildren()) do
  		child.Enabled = true
		end	
			for index, child in pairs(carSeat.Body.ExhaustSmoke.E2:GetChildren()) do
  		child.Enabled = true
		end	
wait(0.5)
carSeat.DriveSeat.Rev:Play()
carSeat.DriveSeat.Rev2:Play()
		for index, child in pairs(carSeat.Body.ExhaustSmoke.E1:GetChildren()) do
  		child.Enabled = false
		end	
			for index, child in pairs(carSeat.Body.ExhaustSmoke.E2:GetChildren()) do
  		child.Enabled = false
			end	
			for index, child in pairs(carSeat.Body.ExhaustSmoke.E3:GetChildren()) do
  		child.Enabled = true
		end	
			for index, child in pairs(carSeat.Body.ExhaustSmoke.E4:GetChildren()) do
  		child.Enabled = true
			end	
			
wait(.03)



	end

end
--Precalculated paths


local t,f,n=true,false,{}
local r={
[58]={{49,45,44,28,29,31,32,34,35,39,41,30,56,58},t},
[49]={{49},t},
[16]={n,f},
[19]={{49,45,44,28,29,31,32,34,35,39,41,30,56,58,20,19},t},
[59]={{49,45,44,28,29,31,32,34,35,39,41,59},t},
[63]={{49,45,44,28,29,31,32,34,35,39,41,30,56,58,23,62,63},t},
[34]={{49,45,44,28,29,31,32,34},t},
[21]={{49,45,44,28,29,31,32,34,35,39,41,30,56,58,20,21},t},
[48]={{49,48},t},
[27]={{49,45,44,28,27},t},
[14]={n,f},
[31]={{49,45,44,28,29,31},t},
[56]={{49,45,44,28,29,31,32,34,35,39,41,30,56},t},
[29]={{49,45,44,28,29},t},
[13]={n,f},
[47]={{49,48,47},t},
[12]={n,f},
[45]={{49,45},t},
[57]={{49,45,44,28,29,31,32,34,35,39,41,30,56,57},t},
[36]={{49,45,44,28,29,31,32,33,36},t},
[25]={{49,45,44,28,27,26,25},t},
[71]={{49,45,44,28,29,31,32,34,35,39,41,59,61,71},t},
[20]={{49,45,44,28,29,31,32,34,35,39,41,30,56,58,20},t},
[60]={{49,45,44,28,29,31,32,34,35,39,41,60},t},
[8]={n,f},
[4]={n,f},
[75]={{49,45,44,28,29,31,32,34,35,39,41,59,61,71,72,76,73,75},t},
[22]={{49,45,44,28,29,31,32,34,35,39,41,30,56,58,20,21,22},t},
[74]={{49,45,44,28,29,31,32,34,35,39,41,59,61,71,72,76,73,74},t},
[62]={{49,45,44,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]={{49,45,44,28,29,31,32,33,36,37},t},
[2]={n,f},
[35]={{49,45,44,28,29,31,32,34,35},t},
[53]={{49,48,47,52,53},t},
[73]={{49,45,44,28,29,31,32,34,35,39,41,59,61,71,72,76,73},t},
[72]={{49,45,44,28,29,31,32,34,35,39,41,59,61,71,72},t},
[33]={{49,45,44,28,29,31,32,33},t},
[69]={{49,45,44,28,29,31,32,34,35,39,41,60,69},t},
[65]={{49,45,44,28,29,31,32,34,35,39,41,30,56,58,20,19,66,64,65},t},
[26]={{49,45,44,28,27,26},t},
[68]={{49,45,44,28,29,31,32,34,35,39,41,30,56,58,20,19,66,64,67,68},t},
[76]={{49,45,44,28,29,31,32,34,35,39,41,59,61,71,72,76},t},
[50]={{49,48,47,50},t},
[66]={{49,45,44,28,29,31,32,34,35,39,41,30,56,58,20,19,66},t},
[10]={n,f},
[24]={{49,45,44,28,27,26,25,24},t},
[23]={{49,45,44,28,29,31,32,34,35,39,41,30,56,58,23},t},
[44]={{49,45,44},t},
[39]={{49,45,44,28,29,31,32,34,35,39},t},
[32]={{49,45,44,28,29,31,32},t},
[3]={n,f},
[30]={{49,45,44,28,29,31,32,34,35,39,41,30},t},
[51]={{49,48,47,50,51},t},
[18]={n,f},
[67]={{49,45,44,28,29,31,32,34,35,39,41,30,56,58,20,19,66,64,67},t},
[61]={{49,45,44,28,29,31,32,34,35,39,41,59,61},t},
[55]={{49,48,47,52,53,54,55},t},
[46]={{49,48,47,46},t},
[42]={{49,45,44,28,29,31,32,34,35,38,42},t},
[40]={{49,45,44,28,29,31,32,34,35,40},t},
[52]={{49,48,47,52},t},
[54]={{49,48,47,52,53,54},t},
[43]={n,f},
[7]={n,f},
[9]={n,f},
[41]={{49,45,44,28,29,31,32,34,35,39,41},t},
[17]={n,f},
[38]={{49,45,44,28,29,31,32,34,35,38},t},
[28]={{49,45,44,28},t},
[5]={n,f},
[64]={{49,45,44,28,29,31,32,34,35,39,41,30,56,58,20,19,66,64},t},
}
return r
--[=[
	This function merges two dictionaries.

	Keys *will* overwrite- if there are duplicate keys, dictionary2 will take priority.

	```lua
	local Dictionary = {
		A = 1,
		B = 2,
	}
	local SecondDictionary = {
		C = 3,
		D = 4,
	}
	
	print(TableKit.MergeDictionary(Dictionary, SecondDictionary)) -- prints { ["A"] = 1, ["B"] = 2, ["C"] = 3, ["D"] = 4 }
	```
	
	:::caution Potential overwrite
	Keys are overwritten when using .MergeDictionary()
	
	@within TableKit
	@param dictionary1 table
	@param dictionary2 table
	@return table
]=]


function TableKit.MergeDictionary<dictionary1, dictionary2>(
	dictionary1: { [unknown]: unknown },
	dictionary2: { [unknown]: unknown }
): dictionary1 & dictionary2
	local newTable = table.clone(dictionary1)

	for key, value in dictionary2 do
		newTable[key] = value
	end

	return newTable
end
--[[Weight and CG]]


	Tune.Weight			= 2810		-- Total weight (in pounds)
	Tune.WeightBSize	= {			-- Size of weight brick (dimmensions in studs ; larger = more stable)
	 --[[Width]]		6		,
	 --[[Height]]		4		,
	 --[[Length]]		15		}
	Tune.WeightDist		= 51		-- Weight distribution (0 - on rear wheels, 100 - on front wheels, can be <0 or >100)
	Tune.CGHeight		= .75		-- Center of gravity height (studs relative to median of all wheels)
	Tune.WBVisible		= false		-- Makes the weight brick visible
	
	--Unsprung Weight
	Tune.FWheelDensity	= .1		-- Front Wheel Density
	Tune.RWheelDensity	= .1		-- Rear Wheel Density
	Tune.FWLgcyDensity	= 1			-- Front Wheel Density [PGS OFF]
	Tune.RWLgcyDensity	= 1			-- Rear Wheel Density [PGS OFF]
	
	Tune.AxleSize		= 2			-- Size of structural members (larger = MORE STABLE / carry more weight)
	Tune.AxleDensity	= .1		-- Density of structural members
-- RCM Settings V



self.WeaponWeight		= 4 -- Weapon weight must be enabled in the Config module

self.ShellEjectionMod	= true

self.Holster			= true
self.HolsterPoint		= "Torso"
self.HolsterCFrame		= CFrame.new(0.65,0.1,-0.8) * CFrame.Angles(math.rad(-90),math.rad(15),math.rad(75))

self.FlashChance = 4 -- 0 = no muzzle flash, 10 = Always muzzle flash

self.ADSEnabled 		= { -- Ignore this setting if not using an ADS Mesh
	true, -- Enabled for primary sight
	true} -- Enabled for secondary sight (T)

self.ExplosiveAmmo		= false -- Enables explosive ammo
self.ExplosionRadius	= 70 -- Radius of explosion damage in studs
self.ExplosionType		= "Default" -- Which explosion effect is used from the HITFX Explosion folder
self.IsLauncher			= true -- For RPG style rocket launchers

self.EjectionOverride	= nil -- Don't touch unless you know what you're doing with Vector3s

return self
--/Recoil Modification


module.camRecoil = {
	RecoilUp 		= 1
	,RecoilTilt 	= 1
	,RecoilLeft 	= 1
	,RecoilRight 	= 1
}

module.gunRecoil = {
	RecoilUp 		= 1
	,RecoilTilt 	= 1
	,RecoilLeft 	= 1
	,RecoilRight 	= 1
}

module.AimRecoilReduction = 1
module.AimSpreadReduction = 1

module.MinRecoilPower 			= 1
module.MaxRecoilPower 			= 1
module.RecoilPowerStepAmount 	= 1

module.MinSpread 				= 1
module.MaxSpread 				= 0.1					
module.AimInaccuracyStepAmount 	= 1
module.AimInaccuracyDecrease 	= 1
module.WalkMult 				= 1

module.MuzzleVelocityMod	 	= 1

return module
--//Setup//--


local WindLines = require(script.WindLines)
local WindShake = require(script.WindShake)

local WindSpeed = 20
local WindDirection = Vector3.new(-1, 1, 0)

local WindShakeSettings = {
	WindPower = 0.75,
	WindSpeed = WindSpeed,
	WindDirection = WindDirection
}

local WindLinesSettings = {
	WindDirection = WindDirection,
	WindSpeed = WindSpeed,
	LifeTime = 2,
	SpawnRate = 20
}

local ShakableObjects = {
	"Leaf",
	"Leaves",
	"Bush",
}
-- Function that other scripts can call to change a player's stats


function PlayerStatManager:ChangeStat(player, statName, value)
	local playerUserId = "Player_" .. player.UserId
	sessionData[playerUserId][statName] = value
end

function PlayerStatManager:ChangeStatInTycoonPurchases(player, statName, value)
	local playerUserId = "Player_" .. player.UserId
	sessionData[playerUserId]["TycoonPurchases"][statName] = value
	print("Saving------------------> ",statName)
end

function PlayerStatManager:IncrementStat(player, statName, value)
	local playerUserId = "Player_" .. player.UserId
	if typeof(sessionData[playerUserId][statName]) == "number" then
		sessionData[playerUserId][statName] = sessionData[playerUserId][statName] + value
	end
end


local function setupPlayerData(player)	
	local playerMoney = serverStorage:WaitForChild("PlayerMoney")
	local playerStats = playerMoney:FindFirstChild(player.Name)
	--Sometimes people have duplicate tycoon add e.g in core handler script
	--adds PlayerMoney to storage and number value with player name that holds the 
	--money value 
	if playerStats == nil then
		playerStats = Instance.new("NumberValue",playerMoney)
		playerStats.Name = player.Name
		local isOwner = Instance.new("ObjectValue",playerStats)
		isOwner.Name = "OwnsTycoon"
	end
	local playerUserId = "Player_" .. player.UserId
 
	local success,data = pcall(function()
		return playerData:GetAsync(playerUserId)
	end)
	
	if success then
		if data then
			print("----------Money: ---------> "..data["Money"])
			print("Show tycoon purchases---------------------")
			sessionData[playerUserId] = data
			for key,value in pairs(sessionData[playerUserId]["TycoonPurchases"]) do
				print(key,value)
			end
			print("End printing tycoon purchases-------------")
			
			local playerMoneyChild = playerMoney:FindFirstChild(player.Name)
			if playerMoneyChild then
				playerMoneyChild.Value = playerMoneyChild.Value + data["Money"]
			else print("------------playerMoneyChild is nil") end
			
		else
			print("setupPlayerData no data found for player ",player.Name)	
			wait()
			local money = 0
			local success,err = pcall(function()
				if player:IsInGroup(SaveSettings.giveCashToPlayersInGroup.groupId) then
					local plrCash = playerMoney:FindFirstChild(player.Name)
					if plrCash then
						plrCash.Value = plrCash.Value + SaveSettings.giveCashToPlayersInGroup.cashAmount
						money = plrCash.Value	
					end
				end
			end)
			
			if success == false then
				print(err)
			end
			
			sessionData[playerUserId] = {}
			sessionData[playerUserId]["Money"] = money
			sessionData[playerUserId]["RebirthCount"] = 0
			sessionData[playerUserId]["TycoonPurchases"] = {}
		end	
		playerStats.Changed:Connect(function(newValue) 
			print("playerStats.Changed ",newValue)
			sessionData[playerUserId]["Money"] = newValue
		end)
	else
		warn("Couldn't get data")
		print(data)
	end		
end
-- Visualizes an impact. This will not run if FastCast.VisualizeCasts is false.


function DbgVisualizeHit(atCF: CFrame, wasPierce: boolean): SphereHandleAdornment?
	--if ClientSettings.Debug.Value == false then return nil end
	if true then
		return
	end
	local adornment = Instance.new("SphereHandleAdornment")
	adornment.Adornee = workspace.Terrain
	adornment.CFrame = atCF
	adornment.Radius = 0.1
	adornment.Transparency = 0.25
	adornment.Color3 = (wasPierce == false) and Color3.new(0.2, 1, 0.5) or Color3.new(1, 0.2, 0.2)
	adornment.Parent = GetFastCastVisualizationContainer()
	Debris:AddItem(adornment, 3)
	return adornment
end