Advertisement
Guest User

RLua

a guest
Jun 26th, 2017
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.24 KB | None | 0 0
  1. local player = game.Players.LocalPlayer
  2. player.Chatted:connect(function(msg)
  3.     if string.lower(string.sub(msg,1,6)) == "/spawn" then
  4. local player = game.Players.LocalPlayer
  5. local VisualPet = Instance.new("Model")
  6. VisualPet.Parent = workspace
  7. VisualPet.Name = "VisualPet"
  8. Instance.new("Humanoid").Parent = VisualPet
  9. local CurrentColor = Instance.new("Color3Value")
  10. CurrentColor.Name = "CurrentColor"
  11. CurrentColor.Parent = VisualPet
  12. local Music = Instance.new("Folder")
  13. Music.Parent = VisualPet
  14. Music.Name = "Music"
  15. local Sound = Instance.new("Sound")
  16. Sound.Name = "Sound"
  17. Sound.Parent = Music
  18. Sound.Looped = true
  19. Sound.SoundId = "http://www.roblox.com/asset/?id=853588295"
  20. local Pet = Instance.new("Part")
  21. Pet.Parent = VisualPet
  22. Pet.Size = Vector3.new(2,2,2)
  23. Pet.Material = "Neon"
  24. Pet.Anchored = true
  25. Pet.Name = "Head"
  26. local Light = Instance.new("PointLight")
  27. Light.Parent = Pet
  28. spawn(function()
  29.     while wait() do
  30.     if Sound then
  31.     local OrigCFrame = Pet.CFrame
  32.     Pet.Size = Vector3.new(Sound.PlaybackLoudness / 100, Sound.PlaybackLoudness / 100, Sound.PlaybackLoudness / 100)
  33.     Pet.Color = CurrentColor.Value
  34.     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
  35.     Light.Color = CurrentColor.Value
  36.     Light.Brightness = 1 + (Sound.PlaybackLoudness / 100)
  37.     Light.Range = 16 + (Sound.PlaybackLoudness / 75)
  38.     end
  39.     end
  40. end)
  41. spawn(function()
  42.     while wait() do
  43.         local Color = CurrentColor.Value
  44.         local NewColor = Color3.fromRGB(math.random(0, 255), math.random(0, 255), math.random(0, 255)) 
  45.         for i=0, 1, 0.01 do
  46.             CurrentColor.Value = Color:lerp(NewColor, i)
  47.             wait()
  48.         end
  49.     end
  50. end)
  51. player.Chatted:connect(function(msg)
  52.     if string.lower(string.sub(msg,1,5)) == "/play" then
  53.         Sound:Stop()
  54.         Sound.SoundId = ""
  55.         local Id = string.sub(msg,6)
  56.         print(Id)
  57.         local Asset = game:GetService("MarketplaceService"):GetProductInfo(tonumber(Id))
  58.         local AssetName = "Now Playing: " .. Asset.Name
  59.         VisualPet.Name = AssetName
  60.         Sound.SoundId = "http://www.roblox.com/asset/?id=" .. tonumber(Id)
  61.         Sound.Volume = 1
  62.         Sound.Looped = true
  63.         Sound:Play()
  64.     end
  65. end)
  66. player.Chatted:connect(function(msg)
  67.     if string.lower(string.sub(msg,1,5)) == "/stop" then
  68.         VisualPet:Destroy()
  69.     end
  70.     end)
  71. end
  72. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement