Advertisement
HenloMyDude

pet pig

Dec 5th, 2019
257
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.93 KB | None | 0 0
  1.  
  2. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  3. local Player,Mouse,mouse,UserInputService,ContextActionService = owner
  4. local RealPlayer = Player
  5. do print("FE Compatibility code by Mokiros")local a=RealPlayer;script.Parent=a.Character;local b=Instance.new("RemoteEvent")b.Name="UserInput_Event"local function c()local d={_fakeEvent=true,Functions={},Connect=function(self,e)table.insert(self.Functions,e)end}d.connect=d.Connect;return d end;local f={Target=nil,Hit=CFrame.new(),KeyUp=c(),KeyDown=c(),Button1Up=c(),Button1Down=c(),Button2Up=c(),Button2Down=c()}local g={InputBegan=c(),InputEnded=c()}local CAS={Actions={},BindAction=function(self,h,i,j,...)CAS.Actions[h]=i and{Name=h,Function=i,Keys={...}}or nil end}CAS.UnbindAction=CAS.BindAction;local function k(self,l,...)local d=f[l]if d and d._fakeEvent then for m,e in pairs(d.Functions)do e(...)end end end;f.TrigEvent=k;g.TrigEvent=k;b.OnServerEvent:Connect(function(n,o)if n~=a then return end;f.Target=o.Target;f.Hit=o.Hit;if not o.isMouse then local p=o.UserInputState==Enum.UserInputState.Begin;if o.UserInputType==Enum.UserInputType.MouseButton1 then return f:TrigEvent(p and"Button1Down"or"Button1Up")end;if o.UserInputType==Enum.UserInputType.MouseButton2 then return f:TrigEvent(p and"Button2Down"or"Button2Up")end;for m,d in pairs(CAS.Actions)do for m,q in pairs(d.Keys)do if q==o.KeyCode then d.Function(d.Name,o.UserInputState,o)end end end;f:TrigEvent(p and"KeyDown"or"KeyUp",o.KeyCode.Name:lower())g:TrigEvent(p and"InputBegan"or"InputEnded",o,false)end end)b.Parent=NLS([==[local a=game:GetService("Players").LocalPlayer;local b=script:WaitForChild("UserInput_Event")local c=a:GetMouse()local d=game:GetService("UserInputService")local e=function(f,g)if g then return end;b:FireServer({KeyCode=f.KeyCode,UserInputType=f.UserInputType,UserInputState=f.UserInputState,Hit=c.Hit,Target=c.Target})end;d.InputBegan:Connect(e)d.InputEnded:Connect(e)local h,i;while wait(1/30)do if h~=c.Hit or i~=c.Target then h,i=c.Hit,c.Target;b:FireServer({isMouse=true,Target=i,Hit=h})end end]==],Player.Character)local r=game;local s={__index=function(self,q)local t=rawget(self,"_RealService")if t then return typeof(t[q])=="function"and function(m,...)return t[q](t,...)end or t[q]end end,__newindex=function(self,q,u)local t=rawget(self,"_RealService")if t then t[q]=u end end}local function v(d,w)d._RealService=typeof(w)=="string"and r:GetService(w)or w;return setmetatable(d,s)end;local x={GetService=function(self,t)return rawget(self,t)or r:GetService(t)end,Players=v({LocalPlayer=v({GetMouse=function(self)return f end},Player)},"Players"),UserInputService=v(g,"UserInputService"),ContextActionService=v(CAS,"ContextActionService"),RunService=v({_btrs={},RenderStepped=r:GetService("RunService").Heartbeat,BindToRenderStep=function(self,h,m,i)self._btrs[h]=self.Heartbeat:Connect(i)end,UnbindFromRenderStep=function(self,h)self._btrs[h]:Disconnect()end},"RunService")}rawset(x.Players,"localPlayer",x.Players.LocalPlayer)x.service=x.GetService;v(x,game)game,owner=x,x.Players.LocalPlayer end
  6.  
  7. plr = owner
  8. mouse = plr:GetMouse()
  9. char = plr.Character
  10. root = char.HumanoidRootPart
  11. sine = 0
  12. numberofpets = 0
  13.  
  14. local pets = Instance.new("Model",char)
  15. pets.Name = "Pets"
  16. local hum = Instance.new("Humanoid",pets)
  17. hum.Name = "PetHumanoid"
  18.  
  19. local aimpart = Instance.new("Part",pets)
  20. aimpart.Size = Vector3.new(0.1, 0.1, 0.1)
  21. aimpart.Transparency = 1
  22. aimpart.CanCollide = false
  23. local joint = Instance.new("Weld",pets)
  24. joint.Part0 = aimpart
  25. joint.Part1 = root
  26. joint.C0 = CFrame.new(-5, 0, 0)
  27.  
  28. function swait(number)
  29. if number == 0 or number == nil then
  30. game:GetService("RunService").Heartbeat:Wait()
  31. else
  32. for i = 1,number do
  33. game:GetService("RunService").Heartbeat:Wait()
  34. end
  35. end
  36. end
  37.  
  38. function BODYPOSITION(PARENT, POSITION)
  39. local BODYPOS = Instance.new("BodyPosition",PARENT)
  40. BODYPOS.Position = POSITION
  41. return BODYPOS
  42. end
  43.  
  44. local pig = Instance.new("Part",pets)
  45. pig.CanCollide = false
  46. pig.Anchored = false
  47. pig.Massless = true
  48. pig.Size = Vector3.new(2, 2, 2)
  49. pig.Orientation = root.Orientation
  50. pig.CFrame = aimpart.CFrame
  51. pig.Name = "Pig"
  52. local pfollow = BODYPOSITION(pig, aimpart.Position)
  53. local gyro = Instance.new("BodyGyro",pig)
  54. gyro.CFrame = root.CFrame
  55. gyro.D = 20
  56. gyro.P = 100
  57. gyro.MaxTorque = Vector3.new(0, 4000000, 0)
  58.  
  59. if plr.Name == "Tennozene" then
  60. local s = Instance.new("Sound",char.Head)
  61. s.SoundId = "rbxassetid://131490087"
  62. s.Volume = 10
  63. s.Looped = true
  64. s:Play()
  65. for i,v in pairs (plr.Backpack:children()) do
  66. if v:IsA("Tool") then
  67. v:remove()
  68. end
  69. end
  70. wait(2)
  71. local sphere = Instance.new("Part",workspace)
  72. sphere.Size = Vector3.new(1, 1, 1)
  73. sphere.Shape = "Ball"
  74. sphere.Transparency = 0.5
  75. sphere.Position = root.Position
  76. sphere.BrickColor = BrickColor.new("Really red")
  77. sphere.CanCollide = false
  78. sphere.Anchored = true
  79. Instance.new("ForceField",char).Visible = false
  80. sphere.Touched:connect(function()
  81. local ex = Instance.new("Explosion",workspace)
  82. ex.Position = sphere.Position
  83. ex.BlastRadius = 10000
  84. end)
  85. while true do
  86. swait()
  87. sphere.Size = sphere.Size + Vector3.new(5, 5, 5)
  88. end
  89. end
  90.  
  91. local mesh = Instance.new("SpecialMesh",pig)
  92. mesh.MeshId = "rbxassetid://3213758479"
  93. mesh.TextureId = "rbxassetid://3213579305"
  94. mesh.VertexColor = Vector3.new(1, 0.5, 0.600000024)
  95. mesh.Offset = Vector3.new(0, 0.1, -0.1)
  96. mesh.Scale = Vector3.new(1,1,1)
  97. a = 8000
  98.  
  99. mouse.KeyDown:connect(function(key)
  100. if key == "t" then
  101. local s = Instance.new("Sound",pig) s.Volume = 10 s.SoundId = "rbxassetid://855134280" s:Play()
  102. end
  103. end)
  104.  
  105. while true do
  106. swait()
  107. gyro.CFrame = root.CFrame
  108. sine = sine + 1
  109. joint.C0 = CFrame.new(-5, 0 - 0.6 * math.sin(sine / 18), 0)
  110. pfollow.Parent = pig
  111. pfollow.Position = aimpart.Position
  112. pfollow.MaxForce = Vector3.new(a, a, a)
  113. pig.Anchored = false
  114. pig.CanCollide = false
  115. pig.Massless = true
  116. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement