Pinkstack/roblox-luau-corpus-text huggingface dataset:
--[[
	Function called when the client is notified of a player state update.
]]


function UIController.onClientStateUpdated(currentState)
	if currentState == "pregame" then
		UIController.setView("pregame")
	elseif currentState == "warmup" then
		UIController.setView("warmup")
	elseif currentState == "game" then
		UIController.setView("game")
	elseif currentState == "spectating" then
		UIController.setView("spectating")
	elseif currentState == "finished" then
		UIController.setView("finished")
	elseif currentState == "dead" then
		UIController.setView("dead")
	elseif currentState == "postgame" then
		UIController.setView("postGame")
	end
end
--set color


function Color:SetColor(color : Color3)
	local hue,saturation,value = color:ToHSV()
	self.Color = color
	
	local wheelSize = self.Instance.Wheel.Image.AbsoluteSize
	local wheelMidPos = (wheelSize / 2)
	local maxDist = (wheelSize.X / 2)
	
	local vector = Vector2.new(0.5,0.5)
	
	local hueVector = Vector2.new(-1,0)
	hueVector = rotateVector(hueVector,hue * -360)
	hueVector = rotateVector(hueVector,180)
	
	vector -= hueVector * saturation * 0.5
	self.Instance.Wheel.Image.Select.Position = UDim2.fromScale(vector.X,vector.Y)
	self.Instance.Right.Value.Select.Position = UDim2.new(0,0,1 - value,0)
	
	self:UpdateColor()
	self:SetValueGradient(hue,saturation)
end

return Color
-- Objects


local plr = playerService.LocalPlayer
local char = plr.Character or plr.CharacterAdded:wait()
local settingsDir = script.Settings

function getSetting (name)
	return settingsDir and settingsDir:FindFirstChild(name) and settingsDir[name].Value
end

local normalSpeed = getSetting("Walking speed") or 18 -- The player's walking speed (Roblox default is 16)
local sprintSpeed = getSetting("Running speed") or 26 -- The player's speed while sprinting
local sprinting = false

inputService.InputBegan:Connect(function (key)
	if char.Humanoid.WalkSpeed == 0 then return end
	if key.KeyCode == Enum.KeyCode.LeftShift or key.KeyCode == Enum.KeyCode.RightShift then
		running = true
		if char:FindFirstChild("Humanoid") then	
			char.Humanoid.WalkSpeed = sprintSpeed
		end
	end
end)

inputService.InputEnded:Connect(function (key)
	if char.Humanoid.WalkSpeed == 0 then return end
	if key.KeyCode == Enum.KeyCode.LeftShift or key.KeyCode == Enum.KeyCode.RightShift then
		running = false
		if char:FindFirstChild("Humanoid") then	
			char.Humanoid.WalkSpeed = normalSpeed
		end
	end
end)
--- FUNCTIONS ---



frame:WaitForChild("Paper").MouseEnter:Connect(function()
	connection = frame.Paper.MouseLeave:Connect(function()
		connection:Disconnect()
		tween:Create(frame.Paper, TweenInfo.new(1), {Position = UDim2.new(0.5,0,2,0)}):Play()
		tween:Create(frame.Paper, TweenInfo.new(1), {BackgroundTransparency = 1}):Play()
		tween:Create(frame.Paper, TweenInfo.new(1), {ImageTransparency = 1}):Play()
		
		task.wait(1)
		frame.Paper:ClearAllChildren()
	end)
end)
--run this first so if there is a 'white' team it is switched over


if not Settings['AutoAssignTeams'] then
	local teamHire = Instance.new('Team', Teams)
	teamHire.TeamColor = BC.new('White')
	teamHire.Name = "For Hire"
end

for i,v in pairs(script.Parent:WaitForChild('Tycoons'):GetChildren()) do
	Tycoons[v.Name] = v:Clone() -- Store the tycoons then make teams depending on the tycoon names
	if returnColorTaken(v.TeamColor) then
		--//Handle duplicate team colors
		local newColor;
		repeat
			wait()
			newColor = BC.Random()
		until returnColorTaken(newColor) == false
		v.TeamColor.Value = newColor
	end
	--Now that there are for sure no duplicates, make your teams
	local NewTeam = Instance.new('Team',Teams)
	NewTeam.Name = v.Name
	NewTeam.TeamColor = v.TeamColor.Value
	if not Settings['AutoAssignTeams'] then
		NewTeam.AutoAssignable = false
	end
	v.PurchaseHandler.Disabled = false
end

function getPlrTycoon(player)
	for i,v in pairs(script.Parent.Tycoons:GetChildren()) do
		if v:IsA("Model") then
			if v.Owner.Value == player then
				return v
			end
		end
	end
	return nil
end

game.Players.PlayerRemoving:connect(function(player)
	local plrStats = game.ServerStorage.PlayerMoney:FindFirstChild(player.Name)
	if plrStats ~= nil then
		plrStats:Destroy()
	end
	local tycoon = getPlrTycoon(player)
	if tycoon then
		local backup = Tycoons[tycoon.Name]:Clone()
		tycoon:Destroy()
		wait()
		backup.Parent=script.Parent.Tycoons
	end
end)
--	local minPosition = offsetPosition - object.Base.Size/2
--	local maxPosition = offsetPosition + object.Base.Size/2	


	local minPosition = offsetPosition - worldBaseSize/2
	local maxPosition = offsetPosition + worldBaseSize/2	
	
	local stepsX = self.BuildZone.Plot.Size.X / tileSize.X
	local stepsZ = self.BuildZone.Plot.Size.Z / tileSize.Z
	
	local minX = math.floor(stepsX * minPosition.X / plot.Size.X + 0.5)
	local minZ = math.floor(stepsZ * minPosition.Z / plot.Size.Z + 0.5)
	
	local maxX = math.floor(stepsX * maxPosition.X / plot.Size.X + 0.5)
	local maxZ = math.floor(stepsZ * maxPosition.Z / plot.Size.Z + 0.5)
	
	local x, z
	for x = minX, maxX-1 do
		for z = minZ, maxZ-1 do
			self.PlotGrid[x+1][z+1] = true
-- functions



REMOTES.GetDebugInfo.OnServerInvoke = function()
	if not serverRegion then
		local json	= HttpService:GetAsync("http://ip-api.com/json")
		local data	= HttpService:JSONDecode(json)
		
		serverRegion	= data.regionName
	end
	
	local info	= {
		ServerRegion	= serverRegion;
	}
	
	return info
end
--Rescripted by Luckymaxer



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

Players = game:GetService("Players")

Animations = {}
Sounds = {}

ServerControl = Tool:WaitForChild("ServerControl")
ClientControl = Tool:WaitForChild("ClientControl")

ClientControl.OnClientInvoke = (function(Mode, Value)
	if Mode == "PlayAnimation" then
		for i, v in pairs(Animations) do
			if v.Animation == Value then
				v.AnimationTrack:Stop()
				table.remove(Animations, i)
			end
		end
		local AnimationTrack = Humanoid:LoadAnimation(Value.Animation)
		table.insert(Animations, {Animation = Value.Animation, AnimationTrack = AnimationTrack})
		AnimationTrack:Play(nil, nil, Value.Speed)
	elseif Mode == "PlaySound" then
		for i, v in pairs(Sounds) do
			if v == Value then
				table.remove(Sounds, i)
			end
		end
		table.insert(Sounds, Value)
		Value:Play()
	end
end)

function InvokeServer(Mode, Value)
	pcall(function()
		ServerControl:InvokeServer(Mode, Value)
	end)
end

function Equipped(Mouse)
	Character = Tool.Parent
	Player = Players:GetPlayerFromCharacter(Character)
	Humanoid = Character:FindFirstChild("Humanoid")
	if not Player or not Humanoid or Humanoid.Health == 0 then
		return
	end
	Mouse.Button1Down:connect(function()
		InvokeServer("MouseClick", true)
	end)
end

function Unequipped()
	for i, v in pairs(Animations) do
		if v and v.AnimationTrack then
			v.AnimationTrack:Stop()
		end
	end
	for i, v in pairs(Sounds) do
		if v then
			v:Stop()
		end
	end
	Animations = {}
	Sounds = {}
end

Tool.Equipped:connect(Equipped)
Tool.Unequipped:connect(Unequipped)
-- functions



function stopAllAnimations()
	local oldAnim = currentAnim

	-- return to idle if finishing an emote
	if (emoteNames[oldAnim] ~= nil and emoteNames[oldAnim] == false) then
		oldAnim = "idle"
	end
	
	if currentlyPlayingEmote then
		oldAnim = "idle"
		currentlyPlayingEmote = false
	end

	currentAnim = ""
	currentAnimInstance = nil
	if (currentAnimKeyframeHandler ~= nil) then
		currentAnimKeyframeHandler:disconnect()
	end

	if (currentAnimTrack ~= nil) then
		currentAnimTrack:Stop()
		currentAnimTrack:Destroy()
		currentAnimTrack = nil
	end

	-- clean up walk if there is one
-- -- -- -- -- -- --
--DIRECTION SCROLL--
-- -- -- -- -- -- --




while true do
	wait()
	if Elevator:WaitForChild("Direction").Value ~= 0 then 
		if Elevator:WaitForChild("Velocity").Value == 0 then
		    if Elevator:WaitForChild("Direction").Value == 1 then
		        This.Display.ARW1.Up1.Transparency = 0
		        This.Display.ARW1.Down1.Transparency = 1
		    else
		        This.Display.ARW1.Up1.Transparency = 1
		        This.Display.ARW1.Down1.Transparency = 0
		    end
	    elseif Elevator:WaitForChild("Velocity").Value ~= 0 then
		    if Elevator:WaitForChild("Direction").Value == 1 then
			    wait(0.5)
			    This.Display.ARW1.Up1.Transparency = 0
			    This.Display.ARW1.Down1.Transparency = 1
			    wait(0.5)
			    This.Display.ARW1.Up1.Transparency = 1
			    This.Display.ARW1.Down1.Transparency = 1
		    else
			    wait(0.5)
			    This.Display.ARW1.Down1.Transparency = 0
			    This.Display.ARW1.Up1.Transparency = 1
			    wait(0.5)
			    This.Display.ARW1.Down1.Transparency = 1
			    This.Display.ARW1.Up1.Transparency = 1
		    end
		end
	else
		This.Display.ARW1.Up1.Transparency = 1
		This.Display.ARW1.Down1.Transparency = 1
	end
end
--[[
	Manages batch updating of spring objects.
]]



local RunService = game:GetService("RunService")

local Package = script.Parent.Parent
local Types = require(Package.Types)
local packType = require(Package.Animation.packType)
local springCoefficients = require(Package.Animation.springCoefficients)
local updateAll = require(Package.Dependencies.updateAll)

type Set<T> = {[T]: any}
type Spring = Types.Spring<any>

local SpringScheduler = {}

local EPSILON = 0.0001
local activeSprings: Set<Spring> = {}
local lastUpdateTime = os.clock()

function SpringScheduler.add(spring: Spring)
	-- we don't necessarily want to use the most accurate time - here we snap to
	-- the last update time so that springs started within the same frame have
	-- identical time steps
	spring._lastSchedule = lastUpdateTime
	spring._startDisplacements = {}
	spring._startVelocities = {}
	for index, goal in ipairs(spring._springGoals) do
		spring._startDisplacements[index] = spring._springPositions[index] - goal
		spring._startVelocities[index] = spring._springVelocities[index]
	end

	activeSprings[spring] = true
end

function SpringScheduler.remove(spring: Spring)
	activeSprings[spring] = nil
end


local function updateAllSprings()
	local springsToSleep: Set<Spring> = {}
	lastUpdateTime = os.clock()

	for spring in pairs(activeSprings) do
		local posPos, posVel, velPos, velVel = springCoefficients(lastUpdateTime - spring._lastSchedule, spring._currentDamping, spring._currentSpeed)

		local positions = spring._springPositions
		local velocities = spring._springVelocities
		local startDisplacements = spring._startDisplacements
		local startVelocities = spring._startVelocities
		local isMoving = false

		for index, goal in ipairs(spring._springGoals) do
			local oldDisplacement = startDisplacements[index]
			local oldVelocity = startVelocities[index]
			local newDisplacement = oldDisplacement * posPos + oldVelocity * posVel
			local newVelocity = oldDisplacement * velPos + oldVelocity * velVel

			if math.abs(newDisplacement) > EPSILON or math.abs(newVelocity) > EPSILON then
				isMoving = true
			end

			positions[index] = newDisplacement + goal
			velocities[index] = newVelocity
		end

		if not isMoving then
			springsToSleep[spring] = true
		end
	end

	for spring in pairs(activeSprings) do
		spring._currentValue = packType(spring._springPositions, spring._currentType)
		updateAll(spring)
	end

	for spring in pairs(springsToSleep) do
		activeSprings[spring] = nil
	end
end

RunService:BindToRenderStep(
	"__FusionSpringScheduler",
	Enum.RenderPriority.First.Value,
	updateAllSprings
)

return SpringScheduler
--[[
	* Copyright (c) Roblox Corporation. All rights reserved.
	* Licensed under the MIT License (the "License");
	* you may not use this file except in compliance with the License.
	* You may obtain a copy of the License at
	*
	*     https://opensource.org/licenses/MIT
	*
	* Unless required by applicable law or agreed to in writing, software
	* distributed under the License is distributed on an "AS IS" BASIS,
	* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
	* See the License for the specific language governing permissions and
	* limitations under the License.
]]


local Packages = script.Parent.Parent
local Number = require(Packages.Number)
--[=[
	Yields the thread until a `:Fire` call occurs, returns what the signal was fired with.

	```lua
	task.spawn(function()
		print(
			ScriptSignal:Wait()
		)
	end)

	ScriptSignal:Fire("Arg", nil, 1, 2, 3, nil)
	-- "Arg", nil, 1, 2, 3, nil are printed
	```

	@yields
	@return ...any
	@ignore
]=]


function ScriptSignal:Wait(): (...any)
    local thread
    do
        thread = coroutine.running()

        local connection
        connection = self:Connect(function(...)
            connection:Disconnect()
            task.spawn(thread, ...)
        end)
    end

    return coroutine.yield()
end
--		for i, v in pairs({FrontLeftHip, FrontRightHip, BackLeftHip, BackRightHip}) do
--			v.MaxVelocity = 0.5
--		end


		LimbAmplitude = 0.2
		LimbFrequency = 7
		ClimbFudge = math.pi
	else
		LimbAmplitude = 0.05
		LimbFrequency = 2
	end
	
	if not Flying.Value then
		LeftWing.DesiredAngle = 0
		RightWing.DesiredAngle = 0
		local LimbDesiredAngle = (LimbAmplitude * math.sin(Time * LimbFrequency))
-- Find the device's rotation via gyroscope and apply to the segway


	UserInputService.DeviceRotationChanged:connect(function(rotation, rotCFrame)
	local x,y = rotCFrame:toEulerAnglesXYZ()
	local Sensitivity = 1.9
	
		-- Direction
		if -x*Sensitivity > -1 and -x*Sensitivity < 1 then -- Makes sure the device isn't tilted too much
			Direction = -x*Sensitivity+0.4
		elseif -x*Sensitivity > 0 then -- Otherwise we'll go to the max speed
			Direction = 1
		elseif -x*Sensitivity < 0 then -- Otherwise we'll go to the max speed
			Direction = -1
		end
			
			-- Steering
			if -y*Sensitivity > -1 and -y*Sensitivity < 1 then -- Makes sure the device isn't tilted too much
				Steer = -y*Sensitivity
			elseif -y*Sensitivity > 0 then -- Otherwise we'll go to the max speed
				Steer = 1
			elseif -y*Sensitivity < 0 then -- Otherwise we'll go to the max speed
				Steer = -1
			end
	end)
end

UserInputService.InputBegan:connect(function(Key,ProcessedEvent)
	if WeldObject.Value ~= nil and not ProcessedEvent then
		
		-- Hop off segway if press Spacebar, Backspace or controller A button
		if Key.KeyCode == Enum.KeyCode.Space or Key.KeyCode == Enum.KeyCode.Backspace or Key.KeyCode == Enum.KeyCode.ButtonA then	
			Hopoff()
		end
		
		--Forward
		if Key.KeyCode == Enum.KeyCode.W or Key.KeyCode == Enum.KeyCode.Up or Key.KeyCode == Enum.KeyCode.ButtonR2 then
			if Direction ~= 1 then
			Direction = 1
			end
		end
		
		--Backward
		if Key.KeyCode == Enum.KeyCode.S or Key.KeyCode == Enum.KeyCode.Down or Key.KeyCode == Enum.KeyCode.ButtonL2 then
			if Direction ~= -1 then
			Direction = -1
			end
		end
		
		--Left
		if Key.KeyCode == Enum.KeyCode.D or Key.KeyCode == Enum.KeyCode.Right then
			if Steer ~= 1 then
			Steer = 1
			end
		end
		
		--Right
		if Key.KeyCode == Enum.KeyCode.A or Key.KeyCode == Enum.KeyCode.Left then
			if Steer ~= -1 then
			Steer = -1
			end
		end
	end
end)
-- This table will make sure that when we stop an animation it is
-- because it is the only animation of it running


local PlayCountTable = {}


local function PlayAnimation(animation, valueToCheck, animationLength)
	if valueToCheck and valueToCheck.Value then
		if MyHumanoid then
			animation:Play()
			if PlayCountTable[animation] then
				PlayCountTable[animation] = PlayCountTable[animation] + 1
			end
			-- wait the duration of the animation	
			if animationLength then
				wait(animationLength)
				if PlayCountTable[animation] then
					PlayCountTable[animation] = PlayCountTable[animation] - 1
					if PlayCountTable[animation] == 0 then
						animation:Stop()
					end
				end
			end
		end
	end
end

function OnEquipped()
	MyHumanoid = Tool.Parent:FindFirstChild('Humanoid')
	downStabAnim = MyHumanoid:LoadAnimation(WaitForChild(Tool, 'DownStab'))
	PlayCountTable[downStabAnim] = 0
	stabPunchAnim = MyHumanoid:LoadAnimation(WaitForChild(Tool, 'StabPunch'))
	PlayCountTable[stabPunchAnim] = 0
	throwAnim = MyHumanoid:LoadAnimation(WaitForChild(Tool, 'Throw'))
	PlayCountTable[throwAnim] = 0
	throwChargeAnim = MyHumanoid:LoadAnimation(WaitForChild(Tool, 'ThrowCharge'))
	PlayCountTable[throwChargeAnim] = 0
	

	local playStabPunch = WaitForChild(Tool, 'PlayStabPunch')
	local playDownStab = WaitForChild(Tool, 'PlayDownStab')
	local playThrow = WaitForChild(Tool, 'PlayThrow')
	local playThrowCharge = WaitForChild(Tool, 'PlayThrowCharge')

	playStabPunch.Changed:connect(function() PlayAnimation(stabPunchAnim, playStabPunch, 1.0) end)
	playDownStab.Changed:connect(function() PlayAnimation(downStabAnim, playDownStab, 1.0) end)
	playThrow.Changed:connect(function() PlayAnimation(throwAnim, playThrow, 1.5) end)
	playThrowCharge.Changed:connect(function(value)
		if value then
			PlayAnimation(throwChargeAnim, playThrowCharge, 1.0)
		else
			throwChargeAnim:Stop()
		end
	end)
end

function OnUnequipped()
	if downStabAnim then
		downStabAnim:Stop()
		downStabAnim = nil
	end
	if stabPunchAnim then
		stabPunchAnim:Stop()
		stabPunchAnim = nil
	end
	if throwAnim then
		throwAnim:Stop()
		throwAnim = nil
	end
	if throwChargeAnim then
		throwChargeAnim:Stop()
		throwChargeAnim = nil
	end
	PlayCountTable = {}
end

Tool.Equipped:connect(OnEquipped)
Tool.Unequipped:connect(OnUnequipped)
-- SirNoobly



local hat = script.Parent
hat.PrimaryPart = hat:WaitForChild("Head") -- Make sure the Head is the same size as a normal Head.

function weldParts(part0, part1) -- welds the 2 parts based on their position
	local newWeld = Instance.new("Weld")
	newWeld.Part0  = part0
	newWeld.Part1  = part1
	newWeld.C0     = CFrame.new()
	newWeld.C1     = part1.CFrame:toObjectSpace(part0.CFrame)
	newWeld.Parent = part0
end

hat.Head.Touched:connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid")  and not hit.Parent:FindFirstChild("Earl's Coronet")then else return end
	for _, v in pairs (hit.Parent:GetChildren()) do -- removes all hats
		if v:IsA("Hat") then
			v:Destroy()
		end
	end
	local head = hit.Parent:FindFirstChild("Head")
	local newHat = hat:Clone()
	newHat:FindFirstChild("HatScript"):Destroy()
	newHat:SetPrimaryPartCFrame(head.CFrame) -- puts the head into the head
	newHat.PrimaryPart:Destroy()
	for _, part in pairs (newHat:GetChildren()) do
		if part:IsA("BasePart") then
			weldParts(head, part)
			part.CanCollide = false
			part.Anchored = false
		end
	end
	newHat.Parent = hit.Parent
end)
-- deviation: alias for internal React$ flow types


export type React_Node =
	nil
	| boolean
	| number
	| string
	| React_Element<any>
	-- TODO: only include this once it's more specific than `any`
	-- | React_Portal
	| Array<React_Node?>
	-- TODO Luau: this more closely matches the upstream Iterable<>, hypothetically the UNIQUE_TAG field makes it so we don't unify with other tables and squad field resolution
	| { [string]: React_Node?, UNIQUE_TAG: any? }

export type React_Element<ElementType> = {
	type: ElementType,
	props: React_ElementProps<ElementType>?,
	key: React_Key | nil,
	ref: any,
}

export type React_PureComponent<Props, State = nil> = React_Component<Props, State>
--[[
	Pushes uncalled beforeAll and afterAll hooks back up the stack
]]


function LifecycleHooks:popHooks()
	table.remove(self._stack, #self._stack)
end

function LifecycleHooks:pushHooksFrom(planNode)
	assert(planNode ~= nil)

	table.insert(self._stack, {
		[TestEnum.NodeType.BeforeAll] = self:_getHooksOfType(planNode.children, TestEnum.NodeType.BeforeAll),
		[TestEnum.NodeType.AfterAll] = self:_getHooksOfType(planNode.children, TestEnum.NodeType.AfterAll),
		[TestEnum.NodeType.BeforeEach] = self:_getHooksOfType(planNode.children, TestEnum.NodeType.BeforeEach),
		[TestEnum.NodeType.AfterEach] = self:_getHooksOfType(planNode.children, TestEnum.NodeType.AfterEach),
	})
end
-- black frames not included



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

local Camera = Workspace.CurrentCamera

local Module = {}

Module.Position = UDim2.new(0, 0, 0, 0)
Module.Size = UDim2.new(1, 0, 1, 0)

local function UDim2Absolute(udim2)
	local viewSize = Camera.ViewportSize

	return Vector2.new(
		(udim2.X.Scale * viewSize.X) + udim2.X.Offset,
		(udim2.Y.Scale * viewSize.Y) + udim2.Y.Offset
	)
end
--[[Brakes]]


	Tune.ABSEnabled		= true		-- Implements ABS
	Tune.ABSThreshold	= 20		-- Slip speed allowed before ABS starts working (in SPS) 

	Tune.BrakeForce		= 25000000		-- Total brake force (LuaInt)
	Tune.BrakeBias		= .57		-- Brake bias towards the front, percentage (1 = Front, 0 = Rear, .5 = 50/50)
	Tune.PBrakeForce	= 5000		-- Handbrake force
	Tune.PBrakeBias		= .57		-- Handbrake bias towards the front, percentage (1 = Front, 0 = Rear, .5 = 50/50)
	Tune.EBrakeForce	= 250		-- Engine braking force at redline
-- eventos y sonidos


local eventEquip = script.Parent.Equip
local eventAttack = script.Parent.Attack
local soundEquiped = script.EquipedS
local soundAttack = script.AttackS

tool.Equipped:Connect(function()
	local humanoid = script.Parent.Parent.Humanoid
	animIdleTrack = humanoid:LoadAnimation(animationIdle)
	animIdleTrack:Play()
	soundEquiped:Play()
	-- llamamos al evento
	eventEquip:FireServer(handle, true)
end)

tool.Unequipped:Connect(function()
	animIdleTrack:Stop()
	eventEquip:FireServer(handle, false)
end)

tool.Activated:Connect(function()
	local humanoid = script.Parent.Parent:WaitForChild("Humanoid") -- otra manera de obtener el humanoid
	animAttackTrack = humanoid:LoadAnimation(animAttack)
	animAttackTrack:Play()
	soundAttack:Play()
	-- evento ataquer
	eventAttack:FireServer(true,true, handle) -- esta atacando entonces lo hacemos verdadero
	wait(3)
	animAttackTrack:Stop()
end)
--function SwapToCollarAnimation(victim)
--	local character = victim.Character
--	local animationScript = character:WaitForChild("Animate")
--	animationScript.idle.Animation1.AnimationId = "rbxassetid://".. tostring(script.AnimationsSettings.IdleAnim.Value)
--	animationScript.idle.Animation2.Weight.Value = 0
--	
--	animationScript.jump.JumpAnim.AnimationId = "rbxassetid://".. tostring(script.AnimationsSettings.JumpAnim.Value)
--	animationScript.fall.FallAnim.AnimationId = "rbxassetid://".. tostring(script.AnimationsSettings.FallAnim.Value)
--	
--	animationScript.run.RunAnim.AnimationId = "rbxassetid://".. tostring(script.AnimationsSettings.CrawlAnim.Value)
--	animationScript.walk.WalkAnim.AnimationId = "rbxassetid://".. tostring(script.AnimationsSettings.CrawlAnim.Value)
--end



function module.MakeCollar(owner,victim)
	--crea collare ed attachment
	local attachment0 = GiveCollarGetAttachment(victim)
	local attachment1 = AddAttachmentToArm(owner)
	--
	
	--crea leash
	local newRope = MakeLeash(attachment0, attachment1)
	--
	
	--aggiungi il controllo del giocatore
	AddPlayerController(victim, owner, newRope.RemoveCollar)
	--
	
	--finisci con il controllo della rimozione
	AddCollarRemover(victim,owner,newRope.RemoveCollar)
	--
	
	--cambia le animazioni
	--SwapToCollarAnimation(victim)
	--
end

return module
-- you can mess with these settings


CanToggleMouse = {allowed = true; activationkey = Enum.KeyCode.F;} -- lets you move your mouse around in firstperson
CanViewBody = true 		-- whether you see your body
Sensitivity = 0.6		-- anything higher would make looking up and down harder; recommend anything between 0~1
Smoothness = 0.05		-- recommend anything between 0~1
FieldOfView = 80		-- fov
HeadOffset = CFrame.new(0,0.7,0) -- how far your camer is from your head

local cam = game.Workspace.CurrentCamera
local player = players.LocalPlayer
local m = player:GetMouse()
m.Icon = "http://www.roblox.com/asset/?id=569021388" -- replaces mouse icon
local character = player.Character or player.CharacterAdded:wait()
local human = character.Humanoid
local humanoidpart = character.HumanoidRootPart

local head = character:WaitForChild("Head")
local CamPos,TargetCamPos = cam.CoordinateFrame.p,cam.CoordinateFrame.p 
local AngleX,TargetAngleX = 0,0
local AngleY,TargetAngleY = 0,0

local running = true
local freemouse = false
local defFOV = FieldOfView

local w, a, s, d, lshift = false, false, false, false, false