local UIS = game:GetService('UserInputService') local plr = game.Players.LocalPlayer local char = plr.Character local move = char.HumanoidRootPart local mouse = plr:GetMouse() local Break = false warn('start') local Attack local Attacking = false local Target = nil local Spinning = false local Spin local Target = nil local lastpos = nil local Interact Interact = UIS.InputBegan:Connect(function(input) if input.KeyCode == Enum.KeyCode.Q then move.CFrame = CFrame.new(mouse.Hit.p) + Vector3.new(0,5,0) end if input.KeyCode == Enum.KeyCode.M then warn('Disconnecting') Break = true Interact:Disconnect() end if input.KeyCode == Enum.KeyCode.O then move = char.HumanoidRootPart if Attacking then Attack:Disconnect() Attacking = false print('hit') move.CFrame = lastpos for _, obj in Target.Parent:GetChildren() do if obj:IsA('BasePart') then obj.CanCollide = false end end elseif Attacking == false and mouse.Target then lastpos = move.CFrame Target = mouse.Target if Target.Parent:FindFirstChild('Humanoid') then Target = Target.Parent.HumanoidRootPart for _, obj in Target.Parent:GetChildren() do if obj:IsA('BasePart') then obj.CanCollide = false end end end print('hit') Attacking = true Attack = game:GetService('RunService').RenderStepped:Connect(function() if Break == true then Attack:Disconnect() end if Target then move.CFrame = CFrame.new(Target.CFrame.p) * move.CFrame.Rotation else Attacking = false Attack:Disconnect() end end) end end if input.KeyCode == Enum.KeyCode.Z then if Spinning then Spin:Disconnect() Spinning = false else Spinning = true Spin = game:GetService('RunService').RenderStepped:Connect(function() move.AssemblyAngularVelocity = Vector3.new(0,1000,0) move.AssemblyLinearVelocity = Vector3.zero if Break == true then Spin:Disconnect() end end) end end end)