Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --TEM667TEMMIE
- --this is a cute cat
- --Converted with ttyyuu12345's model to script plugin v4
- function sandbox(var,func)
- local env = getfenv(func)
- local newenv = setmetatable({},{
- __index = function(self,k)
- if k=="script" then
- return var
- else
- return env[k]
- end
- end,
- })
- setfenv(func,newenv)
- return func
- end
- cors = {}
- mas = Instance.new("Model",game:GetService("Lighting"))
- Tool0 = Instance.new("Tool")
- Part1 = Instance.new("Part")
- SpecialMesh2 = Instance.new("SpecialMesh")
- LocalScript3 = Instance.new("LocalScript")
- Script4 = Instance.new("Script")
- Script5 = Instance.new("Script")
- LocalScript6 = Instance.new("LocalScript")
- Tool0.Name = "CompanionLOLcat"
- Tool0.Parent = mas
- Tool0.TextureId = "http://www.roblox.com/asset/?id=319323891"
- Tool0.GripPos = Vector3.new(4.25, 1.35000002, -1)
- Part1.Name = "Handle"
- Part1.Parent = Tool0
- Part1.Rotation = Vector3.new(-169.98999, 82.159996, 170.080002)
- Part1.Locked = true
- Part1.FormFactor = Enum.FormFactor.Custom
- Part1.Size = Vector3.new(1, 2, 4)
- Part1.CFrame = CFrame.new(-6.20698166, 2.31383038, -12.8086195, -0.134318948, -0.0234867707, 0.990659833, -1.38614045e-14, 0.999719083, 0.0237015504, -0.990938187, 0.00318356743, -0.134281218)
- Part1.BottomSurface = Enum.SurfaceType.Smooth
- Part1.TopSurface = Enum.SurfaceType.Smooth
- Part1.Position = Vector3.new(-6.20698166, 2.31383038, -12.8086195)
- Part1.Orientation = Vector3.new(-1.36000001, 97.7200012, 0)
- SpecialMesh2.Parent = Part1
- SpecialMesh2.MeshId = "http://www.roblox.com/asset/?id=319323837"
- SpecialMesh2.Scale = Vector3.new(0.75, 0.75, 0.75)
- SpecialMesh2.TextureId = "http://www.roblox.com/asset/?id=319323867"
- SpecialMesh2.MeshType = Enum.MeshType.FileMesh
- SpecialMesh2.Scale = Vector3.new(0.75, 0.75, 0.75)
- LocalScript3.Name = "MouseIcon"
- LocalScript3.Parent = Tool0
- table.insert(cors,sandbox(LocalScript3,function()
- --Made by Luckymaxer
- Mouse_Icon = "rbxasset://textures/GunCursor.png"
- Reloading_Icon = "rbxasset://textures/GunWaitCursor.png"
- Tool = script.Parent
- Mouse = nil
- function UpdateIcon()
- if Mouse then
- Mouse.Icon = Tool.Enabled and Mouse_Icon or Reloading_Icon
- end
- end
- function OnEquipped(ToolMouse)
- Mouse = ToolMouse
- UpdateIcon()
- end
- function OnChanged(Property)
- if Property == "Enabled" then
- UpdateIcon()
- end
- end
- Tool.Equipped:connect(OnEquipped)
- Tool.Changed:connect(OnChanged)
- end))
- Script4.Parent = Tool0
- table.insert(cors,sandbox(Script4,function()
- --Made by Luckymaxer
- Tool = script.Parent
- Handle = Tool:WaitForChild("Handle")
- Players = game:GetService("Players")
- Debris = game:GetService("Debris")
- InsertService = game:GetService("InsertService")
- Remover = script:WaitForChild("Remover")
- NPCModule = require(191816425)
- ReloadTime = 5
- NPCSpawned = false
- ToolEquipped = false
- ServerControl = (Tool:FindFirstChild("ServerControl") or Instance.new("RemoteFunction"))
- ServerControl.Name = "ServerControl"
- ServerControl.Parent = Tool
- ClientControl = (Tool:FindFirstChild("ClientControl") or Instance.new("RemoteFunction"))
- ClientControl.Name = "ClientControl"
- ClientControl.Parent = Tool
- Handle.Transparency = 0
- Tool.Enabled = true
- function IsTeamMate(Player1, Player2)
- return (Player1 and Player2 and not Player1.Neutral and not Player2.Neutral and Player1.TeamColor == Player2.TeamColor)
- end
- function MakeNPC()
- if PlayerNPC and PlayerNPC.Parent then
- PlayerNPC:Destroy()
- end
- PlayerNPC = NPC:Clone()
- NPCHumanoid = PlayerNPC:FindFirstChild("Humanoid")
- NPCTorso = PlayerNPC:FindFirstChild("Torso")
- NPCFunctions.MakeNPC({NPC = PlayerNPC, AIControl = {
- Creator = Player,
- Mode = "Follow",
- MaxDistance = 100,
- Follow = Player,
- Offset = Vector3.new(4.5, 0, -1.5),
- GeneralOffset = false,
- Chase = true,
- ChaseDistance = 50,
- ChaseRange = 0,
- Target = nil,
- TargetPos = Vector3.new(0, 0, 0),
- Damage = 0,
- SelfSufficient = false
- }})
- local Values = {
- {Name = "Creator", Class = "ObjectValue", Value = Player},
- {Name = "Tool", Class = "ObjectValue", Value = Tool},
- }
- for i, v in pairs(Values) do
- local Value = Instance.new(v.Class)
- Value.Name = v.Name
- Value.Value = v.Value
- Value.Parent = PlayerNPC
- end
- if not NPCHumanoid or not NPCTorso then
- return
- end
- for i, v in pairs({Remover}) do
- local ScriptClone = v:Clone()
- ScriptClone.Disabled = false
- ScriptClone.Parent = PlayerNPC
- end
- NPCHumanoid.Died:connect(function()
- Debris:AddItem(PlayerNPC, 3)
- end)
- PlayerNPC.Changed:connect(function(Property)
- if Property == "Parent" and not PlayerNPC.Parent and NPCSpawned then
- Tool.Enabled = false
- NPCSpawned = false
- wait(ReloadTime)
- Tool.Enabled = true
- end
- end)
- NPCTorso.CFrame = (Torso.CFrame * CFrame.new(PlayerNPC.Offset.Value))
- PlayerNPC.Parent = game:GetService("Workspace")
- NPCHumanoid:ChangeState(Enum.HumanoidStateType.RunningNoPhysics)
- NPCSpawned = true
- end
- function SetTarget(Data)
- if not PlayerNPC or not PlayerNPC.Parent then
- return
- end
- local MousePosition = Data.MousePosition
- local Target = Data.Target
- local TargetValue = PlayerNPC:FindFirstChild("Target")
- local TargetPosValue = PlayerNPC:FindFirstChild("TargetPos")
- local ModeValue = PlayerNPC:FindFirstChild("Mode")
- local OffsetValue = PlayerNPC:FindFirstChild("Offset")
- if not TargetValue or not TargetPosValue or not ModeValue then
- return
- end
- if Target and Target.Parent then
- local character = Target.Parent
- if character:IsA("Hat") then
- character = character.Parent
- end
- local player = Players:GetPlayerFromCharacter(character)
- if player and IsTeamMate(player, Player) then
- return
- end
- local creator = character:FindFirstChild("Creator")
- local humanoid = character:FindFirstChild("Humanoid")
- if creator and (creator.Value == Player or IsTeamMate(Player, creator.Value)) then
- return
- end
- if humanoid and humanoid.Health > 0 then
- if TargetValue then
- TargetValue.Value = character
- ModeValue.Value = "Attack"
- return
- end
- else
- TargetPosValue.Value = MousePosition
- TargetValue.Value = nil
- ModeValue.Value = "MoveTo"
- end
- else
- ModeValue.Value = "Follow"
- end
- end
- function Activated()
- if not ToolEquipped or not CheckIfAlive() then
- return
- end
- if Tool.Enabled and (not PlayerNPC or not PlayerNPC.Parent) then
- else
- local MouseData = InvokeClient("MouseData")
- if not MouseData then
- return
- end
- local MousePosition = MouseData.Position
- local Target = MouseData.Target
- SetTarget({MousePosition = MousePosition, Target = Target})
- end
- end
- function CheckIfAlive()
- return (((Player and Player.Parent and Character and Character.Parent and Humanoid and Humanoid.Parent and Humanoid.Health > 0 and Torso and Torso.Parent) and true) or false)
- end
- function Equipped()
- Handle.Transparency = 1
- Character = Tool.Parent
- Player = Players:GetPlayerFromCharacter(Character)
- Humanoid = Character:FindFirstChild("Humanoid")
- Torso = Character:FindFirstChild("Torso")
- if not CheckIfAlive() then
- return
- end
- ToolEquipped = true
- end
- function Unequipped()
- ToolEquipped = false
- end
- function InvokeClient(Mode, Value)
- local ClientReturn = nil
- pcall(function()
- ClientReturn = ClientControl:InvokeClient(Player, Mode, Value)
- end)
- return ClientReturn
- end
- ServerControl.OnServerInvoke = (function(player, Mode, Value)
- if player ~= Player or not ToolEquipped or not CheckIfAlive() or not Mode or not Value then
- return
- end
- end)
- Tool.Changed:connect(function(Property)
- if not Tool.Parent then
- return
- end
- Spawn(function()
- if not Tool.Enabled or NPCSpawned or not ToolEquipped or not CheckIfAlive() then
- return
- end
- NPCData = NPCModule.GetTable({Key = "MakeNPC", Player = Player})
- NPCFunctions = NPCData.GetData({Player = Player, Tool = Tool})
- LOLcatData = NPCModule.GetTable({Key = "LOLcat", Player = Player})
- if not LOLcatData then
- return
- end
- LOLcatFunctions = LOLcatData.GetData({Player = Player, Tool = Tool, Character = Character})
- if not LOLcatFunctions then
- return
- end
- NPC = LOLcatFunctions.CreateCat()
- Spawn(MakeNPC)
- end)
- Handle.Transparency = ((Players:GetPlayerFromCharacter(Tool.Parent) and ((not NPCSpawned and 1) or 0)) or 0)
- end)
- Tool.Activated:connect(Activated)
- Tool.Equipped:connect(Equipped)
- Tool.Unequipped:connect(Unequipped)
- end))
- Script5.Name = "Remover"
- Script5.Parent = Script4
- Script5.Disabled = true
- table.insert(cors,sandbox(Script5,function()
- --Made by Luckymaxer
- Model = script.Parent
- Players = game:GetService("Players")
- Debris = game:GetService("Debris")
- Creator = Model:FindFirstChild("Creator")
- Tool = Model:FindFirstChild("Tool")
- function DestroyModel()
- Debris:AddItem(Model, 0.5)
- end
- if not Creator or not Creator.Value or not Creator.Value:IsA("Player") or not Creator.Value.Parent or not Tool or not Tool.Value or not Tool.Value.Parent then
- DestroyModel()
- return
- end
- Creator = Creator.Value
- Tool = Tool.Value
- Character = Creator.Character
- if not Character then
- DestroyModel()
- return
- end
- Creator.Changed:connect(function(Property)
- if Property == "Parent" and not Creator.Parent then
- DestroyModel()
- end
- end)
- Character.Changed:connect(function(Property)
- if Property == "Parent" and not Character.Parent then
- DestroyModel()
- end
- end)
- Tool.Changed:connect(function(Property)
- if Property == "Parent" and (not Tool.Parent or (not Tool.Parent:IsA("Backpack") and not Players:GetPlayerFromCharacter(Tool.Parent))) then
- DestroyModel()
- end
- end)
- end))
- LocalScript6.Parent = Tool0
- table.insert(cors,sandbox(LocalScript6,function()
- --Made by Luckymaxer
- Tool = script.Parent
- Handle = Tool:WaitForChild("Handle")
- Players = game:GetService("Players")
- RunService = game:GetService("RunService")
- UserInputService = game:GetService("UserInputService")
- Animations = {}
- ServerControl = Tool:WaitForChild("ServerControl")
- ClientControl = Tool:WaitForChild("ClientControl")
- Rate = (1 / 60)
- ToolEquipped = false
- function SetAnimation(mode, value)
- if mode == "PlayAnimation" and value and ToolEquipped and Humanoid then
- for i, v in pairs(Animations) do
- if v.Animation == value.Animation 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(value.FadeTime, value.Weight, value.Speed)
- elseif mode == "StopAnimation" and value then
- for i, v in pairs(Animations) do
- if v.Animation == value.Animation then
- v.AnimationTrack:Stop(value.FadeTime)
- table.remove(Animations, i)
- end
- end
- end
- end
- function CheckIfAlive()
- return (((Character and Character.Parent and Humanoid and Humanoid.Parent and Humanoid.Health > 0 and Player and Player.Parent) and true) or false)
- end
- function Equipped(Mouse)
- Character = Tool.Parent
- Player = Players:GetPlayerFromCharacter(Character)
- Humanoid = Character:FindFirstChild("Humanoid")
- ToolEquipped = true
- if not CheckIfAlive() then
- return
- end
- PlayerMouse = Player:GetMouse()
- end
- function Unequipped()
- for i, v in pairs(Animations) do
- if v and v.AnimationTrack then
- v.AnimationTrack:Stop()
- end
- end
- Animations = {}
- ToolEquipped = false
- end
- function InvokeServer(mode, value)
- local ServerReturn
- pcall(function()
- ServerReturn = ServerControl:InvokeServer(mode, value)
- end)
- return ServerReturn
- end
- function OnClientInvoke(mode, value)
- if mode == "PlayAnimation" and value and ToolEquipped and Humanoid then
- SetAnimation("PlayAnimation", value)
- elseif mode == "StopAnimation" and value then
- SetAnimation("StopAnimation", value)
- elseif mode == "MouseData" then
- return ((PlayerMouse and {Position = PlayerMouse.Hit.p, Target = PlayerMouse.Target}) or nil)
- end
- end
- ClientControl.OnClientInvoke = OnClientInvoke
- Tool.Equipped:connect(Equipped)
- Tool.Unequipped:connect(Unequipped)
- end))
- for i,v in pairs(mas:GetChildren()) do
- v.Parent = workspace
- pcall(function() v:MakeJoints() end)
- end
- mas:Destroy()
- for i,v in pairs(cors) do
- spawn(function()
- pcall(v)
- end)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement