Advertisement
Guest User

Werd's Visual Pet

a guest
Jun 26th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.89 KB | None | 0 0
  1. -- Credit to werd51 on roblox and Werd51#8785 on discord
  2. -- Cmds: /Spawn(Spawns in the pet) /Play AudioId(Plays the AudioId) and /stop (Destroys the pet)
  3. -- Please note that all cmds are not case sensitive
  4. -- Enjoy! ~werd51
  5. local player = game:GetService("Players").LocalPlayer
  6. game.Lighting.TimeOfDay = 0
  7. game.Lighting.GlobalShadows = false
  8. player.Chatted:connect(function(msg)
  9.     if string.lower(string.sub(msg,1,6)) == "/spawn" then
  10. local player = game.Players.LocalPlayer
  11. local VisualPet = Instance.new("Model")
  12. VisualPet.Parent = workspace
  13. VisualPet.Name = "VisualPet"
  14. Instance.new("Humanoid").Parent = VisualPet
  15. local CurrentColor = Instance.new("Color3Value")
  16. CurrentColor.Name = "CurrentColor"
  17. CurrentColor.Parent = VisualPet
  18. local Music = Instance.new("Folder")
  19. Music.Parent = VisualPet
  20. Music.Name = "Music"
  21. local Sound = Instance.new("Sound")
  22. Sound.Name = "Sound"
  23. Sound.Parent = Music
  24. Sound.Looped = true
  25. Sound.SoundId = "http://www.roblox.com/asset/?id=853588295"
  26. local Pet = Instance.new("Part")
  27. Pet.Parent = VisualPet
  28. Pet.Size = Vector3.new(2,2,2)
  29. Pet.Material = "Neon"
  30. Pet.Anchored = true
  31. Pet.Name = "Head"
  32. local Light = Instance.new("PointLight")
  33. Light.Parent = Pet
  34. --
  35. spawn(function()
  36.     while wait() do
  37.     if Sound then
  38.     local OrigCFrame = Pet.CFrame
  39.     Pet.Size = Vector3.new(Sound.PlaybackLoudness / 200, Sound.PlaybackLoudness / 200, Sound.PlaybackLoudness / 200)
  40.     Pet.Color = CurrentColor.Value
  41.     if Pet.Size.X < 0.5 and Pet.Size.Y < 0.5 and Pet.Size.Z < 0.5 then Pet.Size = Vector3.new(2, 2, 2) end
  42.     Light.Color = CurrentColor.Value
  43.     Light.Brightness = 1 + (Sound.PlaybackLoudness / 200)
  44.     Light.Range = 16 + (Sound.PlaybackLoudness / 75)
  45.     end
  46.     end
  47. end)
  48. spawn(function()
  49.     while wait() do
  50.         local Color = CurrentColor.Value
  51.         local NewColor = Color3.fromRGB(math.random(0, 255), math.random(0, 255), math.random(0, 255)) 
  52.         for i=0, 1, 0.01 do
  53.             CurrentColor.Value = Color:lerp(NewColor, i)
  54.             wait()
  55.         end
  56.     end
  57. end)
  58. player.Chatted:connect(function(msg)
  59.     if string.lower(string.sub(msg,1,5)) == "/play" then
  60.         Sound:Stop()
  61.         Sound.SoundId = ""
  62.         local Id = string.sub(msg,6)
  63.         print(Id)
  64.         local Asset = game:GetService("MarketplaceService"):GetProductInfo(tonumber(Id))
  65.         local AssetName = "Now Playing: " .. Asset.Name
  66.         VisualPet.Name = AssetName
  67.         Sound.SoundId = "http://www.roblox.com/asset/?id=" .. tonumber(Id)
  68.         Sound.Volume = 1
  69.         Sound.Looped = true
  70.         Sound:Play()
  71.         elseif string.lower(string.sub(msg,1,5)) == "/stop" then
  72.         VisualPet:Destroy()
  73.     end
  74. end)
  75. while wait() do
  76. Pet.CFrame = player.Character.Torso.CFrame * CFrame.Angles(0,math.rad(90),0)
  77. Pet.CFrame = Pet.CFrame + Pet.CFrame.lookVector *-6
  78. Pet.CFrame = Pet.CFrame + Vector3.new(0,5,0)
  79. Pet.CFrame = Pet.CFrame * CFrame.Angles(0,math.rad(-90),0)
  80. end
  81. ---player.Chatted:connect(function(msg)
  82. --  if string.lower(string.sub(msg,1,5)) == "/stop" then
  83. --      VisualPet:Destroy()
  84. --  end
  85. --  end)
  86. end
  87. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement