Roblox/luau_corpus huggingface dataset:
--[[**
	Decodes a string from Base64.
	@param [string] Input The input string to decode.
	@returns [string] The newly decoded string.
**--]]
function Base64:Decode(Input)
	local Output = {}
	local Length = 0

	for Index = 1, #Input, 4 do
		local C1, C2, C3, C4 = string.byte(Input, Index, Index + 3)

		local I1 = Indexes[C1] - 1
		local I2 = Indexes[C2] - 1
		local I3 = (Indexes[C3] or 1) - 1
		local I4 = (Indexes[C4] or 1) - 1

		local A = bit32_lshift(I1, 2) + bit32_rshift(I2, 4)
		local B = bit32_lshift(bit32_band(I2, 15), 4) + bit32_rshift(I3, 2)
		local C = bit32_lshift(bit32_band(I3, 3), 6) + I4

		Length = Length + 1
		Output[Length] = A
		if C3 ~= 61 then Length = Length + 1 Output[Length] = B end
		if C4 ~= 61 then Length = Length + 1 Output[Length] = C end
	end

	local NewOutput = {}
	local NewLength = 0

	for Index = 1, Length, 4096 do
		NewLength = NewLength + 1
		NewOutput[NewLength] = string.char(table.unpack(Output, Index, math.min(Index + 4096 - 1, Length)))
	end

	return table.concat(NewOutput)
end

return Base64
----- MAGIC NUMBERS ABOUT THE TOOL -----
-- How much damage a bullet does
local Damage = 50
--[[ By: Brutez, 2/28/2015, 1:34 AM, (UTC-08:00) Pacific Time (US & Canada) ]]--
local PlayerSpawning=false; --[[ Change this to true if you want the NPC to spawn like a player, and change this to false if you want the NPC to spawn at it's current position. ]]--
local AdvancedRespawnScript=script;
repeat Wait(0)until script and script.Parent and script.Parent.ClassName=="Model";
local JaneTheKiller=AdvancedRespawnScript.Parent;
if AdvancedRespawnScript and JaneTheKiller and JaneTheKiller:FindFirstChild("Thumbnail")then
JaneTheKiller:FindFirstChild("Thumbnail"):Destroy();
end;
local GameDerbis=Game:GetService("Debris");
local JaneTheKillerHumanoid;
for _,Child in pairs(JaneTheKiller:GetChildren())do
if Child and Child.ClassName=="Humanoid"and Child.Health~=0 then
JaneTheKillerHumanoid=Child;
end;
end;
local Respawndant=JaneTheKiller:Clone();
if PlayerSpawning then --[[ LOOK AT LINE: 2. ]]--
coroutine.resume(coroutine.create(function()
if JaneTheKiller and JaneTheKillerHumanoid and JaneTheKillerHumanoid:FindFirstChild("Status")and not JaneTheKillerHumanoid:FindFirstChild("Status"):FindFirstChild("AvalibleSpawns")then
SpawnModel=Instance.new("Model");
SpawnModel.Parent=JaneTheKillerHumanoid.Status;
SpawnModel.Name="AvalibleSpawns";
else
SpawnModel=JaneTheKillerHumanoid:FindFirstChild("Status"):FindFirstChild("AvalibleSpawns");
end;
function FindSpawn(SearchValue)
local PartsArchivable=SearchValue:GetChildren();
for AreaSearch=1,#PartsArchivable do
if PartsArchivable[AreaSearch].className=="SpawnLocation"then
local PositionValue=Instance.new("Vector3Value",SpawnModel);
PositionValue.Value=PartsArchivable[AreaSearch].Position;
PositionValue.Name=PartsArchivable[AreaSearch].Duration;
end;
FindSpawn(PartsArchivable[AreaSearch]);
end;
end;
FindSpawn(Game:GetService("Workspace"));
local SpawnChilden=SpawnModel:GetChildren();
if#SpawnChilden>0 then
local SpawnItself=SpawnChilden[math.random(1,#SpawnChilden)];
local RespawningForceField=Instance.new("ForceField");
RespawningForceField.Parent=JaneTheKiller;
RespawningForceField.Name="SpawnForceField";
GameDerbis:AddItem(RespawningForceField,SpawnItself.Name);
JaneTheKiller:MoveTo(SpawnItself.Value+Vector3.new(0,3.5,0));
else
if JaneTheKiller:FindFirstChild("SpawnForceField")then
JaneTheKiller:FindFirstChild("SpawnForceField"):Destroy();
end;
JaneTheKiller:MoveTo(Vector3.new(0,115,0));
end;
end));
end;
function Respawn()
Wait(5);
Respawndant.Parent=JaneTheKiller.Parent;
Respawndant:makeJoints();
Respawndant:FindFirstChild("Head"):MakeJoints();
Respawndant:FindFirstChild("Torso"):MakeJoints();
JaneTheKiller:remove();
end;
if AdvancedRespawnScript and JaneTheKiller and JaneTheKillerHumanoid then
JaneTheKillerHumanoid.Died:connect(Respawn);
end;
---------------------------------------------

local HoldAnim, ThrowAnim;

Tool.Equipped:connect(function(mouse)
	Character = Tool.Parent
	Player = game.Players:GetPlayerFromCharacter(Character)

	local HoldAnimSrc = WaitFor(Tool).HoldAnim()
	HoldAnimSrc.AnimationId = 'http://www.roblox.com/asset/?id=88743592'
	local ThrowAnimSrc = WaitFor(Tool).ThrowAnim()
	ThrowAnimSrc.AnimationId = 'http://www.roblox.com/asset/?id=88743566'

	HoldAnim = Character.Humanoid:LoadAnimation(HoldAnimSrc)
	ThrowAnim = Character.Humanoid:LoadAnimation(ThrowAnimSrc)

	--setup first anim / cursor cycle
	if Now() > NextFireAt.Value then
		Handle.Transparency = 0
		mouse.Icon = 'rbxasset://textures\\GunCursor.png'
		HoldAnim:Play()
	else
		Handle.Transparency = 1
		Delay(NextFireAt.Value - Now(), function()
			mouse.Icon = 'rbxasset://textures\\GunWaitCursor.png'
			Handle.Transparency = 0
			HoldAnim:Play()
		end)
	end

	mouse.Button1Down:connect(function()
		--we track the reload time like this so that the player can't fire faster with
		--rapid dis / re-equipping, which will actually be common usage with this gear.
		if Now() > NextFireAt.Value then
			NextFireAt.Value = Now() + RELOAD_TIME
			--
			local gr = Handle:Clone()
			gr.CanCollide = false
			local sc = GrenadeScript:Clone()
			sc.Parent = gr
			sc.Disabled = false
			WaitFor(sc).creator().Value = Player

			--calc velocity
			local toTarget = mouse.Hit.p - gr.Position
			local dy = toTarget.y
			toTarget = Vector3.new(toTarget.x, 0, toTarget.z)
			local dx = toTarget.magnitude
			toTarget = toTarget.unit

			Velocity = math.min(120, 40 + dx)

			local theta = computeLaunchAngle(dx, dy, 196.2)

			local vY = math.sin(theta)*Velocity
			local vX = toTarget.x * math.cos(theta) * Velocity
			local vZ = toTarget.z * math.cos(theta) * Velocity

			gr.CanCollide = false
			Delay(0.1, function()
				gr.CanCollide = true
			end)
			gr.Velocity = Vector3.new(vX, vY, vZ)
			gr.Parent = game.Workspace

			--play sound / anim
			ThrowSound:Play()
			HoldAnim:Stop(0)
			ThrowAnim:Play(0,1,1)

			--reload
			Handle.Transparency = 1
			mouse.Icon = 'rbxasset://textures\\GunWaitCursor.png'
			wait(RELOAD_TIME)
			HoldAnim:Play()
			Handle.Transparency = 0
			mouse.Icon = 'rbxasset://textures\\GunCursor.png'
		end
	end)
end)

Tool.Unequipped:connect(function()
	if ThrowSound then
		ThrowSound:Stop()
	end
	if ThrowAnim then
		ThrowAnim:Stop()
	end
	if HoldAnim then
		HoldAnim:Stop()
	end
end)
--important stuff to register what is what. you need these if you want to do stuff with the tool itself.
Tool.Activated:connect(Activated)
Tool.Equipped:connect(Equipped)
Tool.Unequipped:connect(Unequipped)
for i,D in pairs(script.Parent:GetChildren()) do
if D.Name == "DP" then
if b == false then
if dmg == true then
b = true
D.Touched:connect(Blow)
wait(1)
b = false
end
end
end
end
--Services
local PathfindingService = game:GetService("PathfindingService")
--//Controller//--
Spawners:Activate()

RunService.RenderStepped:Connect(function()
	if not DBOn then
		if Camera.CameraType ~= Enum.CameraType.Scriptable then
			Camera.CameraType = Enum.CameraType.Scriptable

		end

		Camera.CFrame = CamPart.CFrame
		
	end
	
end)
--	scr.Disabled= false
	-- запускаем его в направлении пушки (смещаем в неправлении взгляда)
--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.Slingshot
--		if Plr.Backpack:FindFirstChild("Reactor Startup Key") then
			key=true
			keyset:Fire()
--[=[
	Returns whether or not a value is an observable.
	@param item any
	@return boolean
]=]
function Observable.isObservable(item)
	return type(item) == "table" and item.ClassName == "Observable"
end
-- Mimic the enabling of the topbar when StarterGui:SetCore("TopbarEnabled", state) is called
coroutine.wrap(function()
	local chatScript = players.LocalPlayer.PlayerScripts:WaitForChild("ChatScript", 4) or game:GetService("Chat"):WaitForChild("ChatScript", 4)
	if not chatScript then return end
	local chatMain = chatScript:FindFirstChild("ChatMain")
	if not chatMain then return end
	local ChatMain = require(chatMain)
	ChatMain.CoreGuiEnabled:connect(function()
		local topbarEnabled = checkTopbarEnabled()
		if topbarEnabled == IconController.previousTopbarEnabled then
			IconController.updateTopbar()
			return "SetCoreGuiEnabled was called instead of SetCore"
		end
		IconController.previousTopbarEnabled = topbarEnabled
		if IconController.controllerModeEnabled then
			IconController.setTopbarEnabled(false,false)
		else
			IconController.setTopbarEnabled(topbarEnabled,false)
		end
		IconController.updateTopbar()
	end)
	IconController.setTopbarEnabled(checkTopbarEnabled(),false)
end)()
-- Critically damped spring class for fluid motion effects
local Spring = {} do
	Spring.__index = Spring

	-- Initialize to a given undamped frequency and default position
	function Spring.new(freq, pos)
		return setmetatable({
			freq = freq,
			goal = pos,
			pos = pos,
			vel = 0,
		}, Spring)
	end

	-- Advance the spring simulation by `dt` seconds
	function Spring:step(dt)
		local f = self.freq*2*math.pi
		local g = self.goal
		local p0 = self.pos
		local v0 = self.vel

		local offset = p0 - g
		local decay = math.exp(-f*dt)

		local p1 = (offset*(1 + f*dt) + v0*dt)*decay + g
		local v1 = (v0*(1 - f*dt) - offset*(f*f*dt))*decay

		self.pos = p1
		self.vel = v1

		return p1
	end
end

CameraUtils.Spring = Spring
--local GameFolder = Workspace.Game:GetDescendants() 

local Gui = PlayerGui:WaitForChild("LoadingScreen")

Gui.Enabled = true
local erase = TweenInfo.new(0.5, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut)

StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.All, false)

local Loaded = 0
local toLoad = #petModelFolder --+ #GameFolder
--- Same as indexing, but uses an incremented number as a key.
-- @param task An item to clean
-- @treturn number taskId
function Maid:giveTask(task)
	if not task then
		error("Task cannot be false or nil", 2)
	end

	local taskId = #self._tasks+1
	self[taskId] = task

	if type(task) == "table" and (not (task.Destroy or task.destroy)) then
		warn("[Maid.GiveTask] - Gave table task without .Destroy\n\n" .. debug.traceback())
	end

	return taskId
end
-- functions

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

function onDied()
	pose = "Dead"
end

function onJumping()
	pose = "Jumping"
end

function onClimbing()
	pose = "Climbing"
end

function onGettingUp()
	pose = "GettingUp"
end

function onFreeFall()
	pose = "FreeFall"
end

function onFallingDown()
	pose = "FallingDown"
end

function onSeated()
	pose = "Seated"
end

function onPlatformStanding()
	pose = "PlatformStanding"
end

function moveJump()
	RightShoulder.MaxVelocity = 0.5
	LeftShoulder.MaxVelocity = 0.5
  RightShoulder:SetDesiredAngle(3.14)
	LeftShoulder:SetDesiredAngle(-3.14)
	RightHip:SetDesiredAngle(0)
	LeftHip:SetDesiredAngle(0)
end
-- Example: Connect buttons to the castVote function
local button1 = script.Parent.MapFrame.VoteButton
local button2 = script.Parent.MapFrame1.VoteButton

button1.MouseButton1Click:Connect(function()
	castVote("Dead Town")
end)

button2.MouseButton1Click:Connect(function()
	castVote("Test Map")
end)
--Globals
local AI = script.Parent
local AIName = AI.Name
local AItorso = AI.Torso


if true then -- if your torso doesn't have a Humanoid; flip this to false
local HumanoidType = nil   -- find-a-HumanoidObject  --  make sure

local list = AI:GetChildren()        -- temp var.
for x = 1, #list do
local temp = list[x]
	if (temp.className == "Humanoid") then  
        HumanoidType = temp.Name
   end  -- found Humanoid
end -- AI Parts

if HumanoidType then
number = math.floor(number*100) -- serial# of AI
hum = AI[HumanoidType]
BRAINWave = 7/hum.WalkSpeed  -- For extreme speeds, this may have to be adjusted.
print (script, ": Humanoid = ", hum, AI:GetFullName(), number, "- Think Speed = ", BRAINWave)
end
end -- set speed
--The main script, this regulates basic values of the local elements
local Steamer = script.Parent.Parent.Content.Steam
local Eaten = script.Parent.Parent.Content
local SoundA = script.Parent.Slurp
local WarmSoup = script.Parent.TastySoup
local Clickable = script.Parent.ClickDetector
function SoupEaten()
Clickable.MaxActivationDistance = 0 -- Fake debounce, but better than normal - less laggy
SoundA:Play()
Steamer.Enabled = false
Eaten.Transparency = 1
WarmSoup.Disabled = true
wait(50)
Eaten.Transparency = 0
WarmSoup.Disabled = false
Clickable.MaxActivationDistance = 15
Steamer.Enabled = true
end
script.Parent.ClickDetector.MouseClick:connect(SoupEaten)
--<DON'T TOUCH THE SCRIPT UNLESS YOU KNOW WHAT YOU ARE DOING!

local RS = game:GetService('ReplicatedStorage')
local TS = game:GetService('TweenService')

local Tool = script.Parent
local TextureArray = {}

local Activated = false
local Debounce = false
local Cooldown = 1
local Prop = nil
local LaughAnim = nil

Tool.Activated:Connect(function()
	if not Debounce then
		Debounce = true
		task.delay(Cooldown, function()
			Debounce = false
		end)
		
		local Character = Tool.Parent
		
		if not Activated then
			Activated = true
			
			LaughAnim = Character.Humanoid:LoadAnimation(RS.GhoulV4.Laugh)
			LaughAnim:Play()
			Character.HumanoidRootPart.Anchored = true
			
			Prop = RS.GhoulV4.Props.Wings:Clone()
			Prop.Parent = Character
	 
			local Attachment = Instance.new('Attachment')
			Attachment.Parent = Character.HumanoidRootPart
			Attachment.Position = Vector3.new(0,-2.5,0)

			local Wave = RS.GhoulV4.Effects.Wave:Clone()
			Wave.Parent = Attachment

			local Smoke = RS.GhoulV4.Effects.Smoke:Clone()
			Smoke.Parent = Character.HumanoidRootPart

			local Pixel = RS.GhoulV4.Effects.Pixel:Clone()
			Pixel.Parent = Character.HumanoidRootPart

			local Laugh = RS.GhoulV4.Sound.Laugh:Clone()
			Laugh.Parent = Character.HumanoidRootPart

			local SmokeSound = RS.GhoulV4.Sound.Smoke:Clone()
			SmokeSound.Parent = Character.HumanoidRootPart

			Laugh:Play()

			task.delay(1.6,function()
				Laugh:Destroy()
				task.wait(0.25)
				Character.HumanoidRootPart.Anchored = false
				LaughAnim:Stop()
			end)

			SmokeSound:Play()

			local Tween = TS:Create(SmokeSound, TweenInfo.new(1.5), {Volume = 0})
			Tween:Play()

			Tween.Completed:Connect(function()
				SmokeSound:Destroy()
			end)	

			Wave:Emit(2)
			Smoke:Emit(100)
			Pixel:Emit(50)

			for _, Item in ipairs(Character.Humanoid:GetAccessories()) do
				local Hair = Item.Handle:FindFirstChild("HairAttachment") ~= nil
				if Hair then
					TextureArray[Item] = {TextureID = Item.Handle.TextureID, Color = Item.Handle.Color, Material = Item.Handle.Material}
					Item.Handle.Color = Color3.fromRGB(255, 0, 0)
					Item.Handle.TextureID = ''
					Item.Handle.Material = Enum.Material.Neon
				end
			end
			
		elseif Activated then
			Activated = false
			
			local Tween = TS:Create(Prop.Handle, TweenInfo.new(0.5), {Transparency = 1})
			Tween:Play()

			Tween.Completed:Connect(function()
				Prop:Destroy()
			end)
			
			for _, Item in ipairs(Character.Humanoid:GetAccessories()) do
				local Hair = Item.Handle:FindFirstChild("HairAttachment") ~= nil
				if Hair then
					Item.Handle.Color = TextureArray[Item].Color
					Item.Handle.Material = TextureArray[Item].Material
					Item.Handle.TextureID = TextureArray[Item].TextureID
					TextureArray[Item] = nil
				end
			end
		end
	end
end)
--[[
	Cleans up the tasks passed in as the arguments.
	A task can be any of the following:

	- an Instance - will be destroyed
	- an RBXScriptConnection - will be disconnected
	- a function - will be run
	- a table with a `Destroy` or `destroy` function - will be called
	- an array - `cleanup` will be called on each item
]]

local function cleanupOne(task: any)
	local taskType = typeof(task)

	-- case 1: Instance
	if taskType == "Instance" then
		task:Destroy()

	-- case 2: RBXScriptConnection
	elseif taskType == "RBXScriptConnection" then
		task:Disconnect()

	-- case 3: callback
	elseif taskType == "function" then
		task()

	elseif taskType == "table" then
		-- case 4: destroy() function
		if typeof(task.destroy) == "function" then
			task:destroy()

		-- case 5: Destroy() function
		elseif typeof(task.Destroy) == "function" then
			task:Destroy()

		-- case 6: array of tasks
		elseif task[1] ~= nil then
			for _, subtask in ipairs(task) do
				cleanupOne(subtask)
			end
		end
	end
end

local function cleanup(...: any)
	for index = 1, select("#", ...) do
		cleanupOne(select(index, ...))
	end
end

return cleanup
--Zombie artificial stupidity script


sp=script.Parent
lastattack=0
nextrandom=0
nextsound=0
nextjump=0
chasing=false

variance=4

damage=10
attackrange=4.5
sightrange=999--60
runspeed=16
wonderspeed=8
healthregen=false
colors={"Sand red","Dusty Rose","Medium blue","Sand blue","Lavender","Earth green","Brown","Medium stone grey","Brick yellow"}

function raycast(spos,vec,currentdist)
	local hit2,pos2=game.Workspace:FindPartOnRay(Ray.new(spos+(vec*.01),vec*currentdist),script.Parent)
	if hit2~=nil and pos2 then
		if hit2.Parent==script.Parent and hit2.Transparency>=.8 or hit2.Name=="Handle" or string.sub(hit2.Name,1,6)=="Effect" or hit2.Parent:IsA("Hat") or hit2.Parent:IsA("Tool") or (hit2.Parent:FindFirstChild("Humanoid") and hit2.Parent:FindFirstChild("TEAM") and hit2.Parent:FindFirstChild("TEAM").Value == script.Parent.TEAM.Value) or (not hit2.Parent:FindFirstChild("Humanoid") and hit2.CanCollide==false) then
			local currentdist=currentdist-(pos2-spos).magnitude
			return raycast(pos2,vec,currentdist)
		end
	end
	return hit2,pos2
end

function waitForChild(parent,childName)
	local child=parent:findFirstChild(childName)
	if child then return child end
	while true do
		child=parent.ChildAdded:wait()
		if child.Name==childName then return child end
	end
end
-- Existance in this list signifies that it is an emote, the value indicates if it is a looping emote
local emoteNames = { wave = false, point = false, dance = true, laugh = false, cheer = false}
-- This is for the buttons effects.
-- Edit if you know what you are doing.

local button = script.Parent
local leftarrow = script.Parent.LeftArrow
local rightarrow = script.Parent.RightArrow
local TweenService = game:GetService("TweenService")
local TweenSpeed = 0.1
local Info = TweenInfo.new(TweenSpeed, Enum.EasingStyle.Quad, Enum.EasingDirection.In, 0)
--[[
    Teleports all players to within the specified part
]]
local Players = game:GetService("Players")
local ServerStorage = game:GetService("ServerStorage")

local PlayerManager = require(ServerStorage.Source.Managers.PlayerManager)

return function(spawnPart)
	for _, player in pairs(Players:GetPlayers()) do
		if player.Character and player.Character.PrimaryPart then
			local primaryPart = player.Character.PrimaryPart
			if primaryPart:CanSetNetworkOwnership() then
				primaryPart:SetNetworkOwner(nil)
			end

			local cFrame =
				spawnPart.CFrame *
				CFrame.new(
					math.random(-spawnPart.Size.X * 0.5 * 100, spawnPart.Size.X * 0.5 * 100) / 100,
					3,
					math.random(-spawnPart.Size.Z * 0.5 * 100, spawnPart.Size.Z * 0.5 * 100) / 100
				)

			primaryPart.CFrame = cFrame

			if primaryPart:CanSetNetworkOwnership() then
				primaryPart:SetNetworkOwner(player)
			end
		else
			local serverPlayerComponent = PlayerManager.getFromPlayer(player)

			if serverPlayerComponent and serverPlayerComponent.status.currentState == "game" then
				serverPlayerComponent.stateMachine:get():startSpectating()
			end
		end
	end
end
--Makes sure the part is scaled properly----------
local function Confirm(Grid, Plot)
	if X % Grid ~= 0 then
		X = math.clamp(X - 1, 1, 78)
		
		Confirm(Grid, Plot)
	end
	
	if Z % Grid ~= 0 then
		Z = math.clamp(Z - 1, 1, 78)
		
		Confirm(Grid, Plot)
	end
end
--== OK DEVON MAKE THIS ==--

local RunService = game:GetService("RunService")
local Players = game:GetService("Players")
local TS = game:GetService("TweenService")

local Player = Players.LocalPlayer
local Character = script.Parent

local Humanoid = Character:FindFirstChildOfClass("Humanoid")

local camera = workspace.Camera

repeat wait() until Humanoid

local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart")
local Torso = Character:WaitForChild("Torso")

local RootJoint = HumanoidRootPart:WaitForChild("RootJoint")

local function Lerp(a, b, c)
	return a + (b - a) * c
end

local Force = nil
local Direction = nil
local Value1 = 0
local Value2 = 0

local RootJointC0 = RootJoint.C0


RunService.RenderStepped:Connect(function()
	Force = HumanoidRootPart.Velocity * Vector3.new(0.2, 0, 0.2)

	if Force.Magnitude > 2 then
		Direction = Force.Unit
		Value1 = HumanoidRootPart.CFrame.RightVector:Dot(Direction)
		Value2 = HumanoidRootPart.CFrame.LookVector:Dot(Direction)
	else
		Value1 = 0
		Value2 = 0
	end

	RootJoint.C0 = RootJoint.C0:Lerp(RootJointC0 * CFrame.Angles(math.rad(Value2 * 8), math.rad(-Value1 * 7), 0), 0.2)
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 Test()
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.AttackScript.Disabled = true
script.Parent.Parent.On.Value = true
script.Parent.Parent.Parent.FederalSignalRC6.Modulate.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.Mode.Value = 4
	signallmp.Value = false
	script.Parent.Parent.On.Value = false
	script.Parent.Parent.Parent.FederalSignalRC6.Modulate.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)
--	====================
--	BASIC
--	A basic settings for the gun
--	====================

		Auto = false;
		MuzzleOffset = Vector3.new(0, 0.625, 1.25);
		BaseDamage = 25;
		FireRate = 0.05; --In second
		ReloadTime = 2.7; --In second
		AmmoPerClip = 5; --Put "math.huge" to make this gun has infinite ammo and never reload
		Spread = 1.25; --In degree
		HeadshotEnabled = true; --Enable the gun to do extra damage on headshot
		HeadshotDamageMultiplier = 3;
		MouseIconID = "316279304";
		HitSoundIDs = {186809061,186809249,186809250,186809252};
		IdleAnimationID = 94331086; --Set to "nil" if you don't want to animate
		IdleAnimationSpeed = 1;
		FireAnimationID = 94332152; --Set to "nil" if you don't want to animate
		FireAnimationSpeed = 6;
		ReloadAnimationID = nil; --Set to "nil" if you don't want to animate
		ReloadAnimationSpeed = 1;
--RAIN PHYSICS / GENERATION
local RainFallSpeed = 150 --Studs the rain falls per second
local RainGroupsPerSecond = 400 --Amount of rain drops per second
local RainRadius = 200 --Radius from the camera in studs where rain drops will spawn
local StartY = 100 --Start height of the rain
local DefaultEndY = -10 --Default end height of the rain. Can be overriden for certain zones
local WindSpeedX = 0 --Wind speed in studs on X axis
local WindSpeedZ = 0 --Wind speed in studs on Z axis