Advertisement
Rovo112

Guess that song Script

Feb 19th, 2015
1,016
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.55 KB | None | 0 0
  1. local Songs = {
  2. {id ="176446794",Name="Magic"};
  3. {id ="176446794",Name="Astronomia 2014"};
  4. {id ="183596502",Name="Zombie (3LAU Edit)"};
  5. {id ="165065112",Name="Beam (Proximity)"};
  6. {id ="196917825",Name="Life of a noob"};
  7. {id ="177259728",Name="Fancy"};
  8. {id ="213770214",Name="Avicii Levels REMIX"};
  9. {id ="160753085",Name="pet smudge everyday"};
  10. {id ="152102303",Name="Good Time"};
  11. {id ="190961148",Name="Beg For It"};
  12. {id ="143204341",Name="Dark Horse"};
  13. {id ="174584892",Name="Anaconda"};
  14. {id ="157202036",Name="Ghost"};
  15. }
  16. local GuiStore = Game:GetService("ReplicatedStorage"):FindFirstChild("Gui_Store") or error("Cannot find Gui_Store",3)
  17. local DefTime = 60
  18. local LocalPlayer = game:GetService("Players").LocalPlayer
  19.  
  20. local function GetPGui()
  21. if not LocalPlayer then return false end
  22. local PlrGui = LocalPlayer:findFirstChild("PlayerGui")
  23. if not PlrGui then return false end
  24. local MainGui = PlrGui:findFirstChild("MainGui")
  25. if not MainGui then
  26. MainGui = Instance.new("ScreenGui",PlrGui)
  27. MainGui.Name = "MainGui"
  28. end
  29. return MainGui
  30. end
  31.  
  32. local function Notify(Message)
  33. if not Message or not tostring(Message) then return end
  34. local M = GuiStore:findFirstChild("Notification")
  35. if not M then return end
  36. local PlrGui = GetPGui()
  37. if PlrGui == false then return end
  38. local Clone = M:Clone()
  39. Clone.Parent = PlrGui
  40. local Txt = Clone:FindFirstChild("Message")
  41. if Txt then pcall(function() Txt.Text = tostring(Message) end) end
  42. Clone:TweenPosition(UDim2.new(0.35,0,0.35,0), "Out", "Quad", 0.2, true)
  43. wait(3)
  44. Clone:TweenPosition(UDim2.new(0.35,0,-0.35,0),"Out","Quad",0.2,true)
  45. pcall(Game.Destroy,Clone)
  46. end
  47.  
  48. local function PlaySound(Name, id)
  49. if not Name or not tostring(Name) then return end
  50. if not id or not tostring(id) then return end
  51.  
  52. local PlrGui = GetPGui()
  53. if PlrGui == false then return end
  54.  
  55. local SoundGuessGui = GuiStore:findFirstChild("Guess_sound")
  56. if not SoundGuessGui then return end
  57.  
  58. local CorrectGuess = false
  59. local Breakloop = false
  60. local CurrentTime = 0
  61. local Clone = SoundGuessGui:Clone()
  62. Clone.Parent = PlrGui
  63.  
  64. local Sound = Instance.new("Sound",Workspace.Camera)
  65. Sound.SoundId = "http://www.roblox.com/asset/?id="..tostring(id)
  66. Sound.Pitch = 1
  67. Sound.Looped = true
  68. Sound.Volume = 1
  69. Sound:Play()
  70.  
  71. repeat wait() until Sound.TimePosition ~= 0
  72.  
  73. Clone:TweenPosition(UDim2.new(0.4,0,0,0), "Out", "Quad", 0.2, true)
  74.  
  75. local ChattedEvent
  76. ChattedEvent = LocalPlayer.Chatted:connect(function(m)
  77. if m:lower():find("give up") and not Name:lower():find("give up") then
  78. Breakloop = true
  79. elseif m:lower() == Name:lower() then
  80. CorrectGuess = true
  81. Breakloop = true
  82. end
  83. end)
  84.  
  85. coroutine.wrap(function()
  86. while wait(1) and Breakloop == false do
  87. CurrentTime = CurrentTime + 1
  88. end
  89. end)()
  90.  
  91. repeat
  92. if Clone and Clone.Parent and Clone:findFirstChild("Seconds left") then
  93. local Msg = Clone:findFirstChild("Seconds left")
  94. local Time = tostring(math.floor(DefTime - CurrentTime))
  95. if tonumber(Time) < 10 then Time = "0"..Time end
  96. Msg.Text = "00:" .. Time
  97. end
  98. wait()
  99. until CurrentTime >= DefTime or CorrectGuess == true or Breakloop == true
  100. Breakloop = true
  101. pcall(function() ChattedEvent:disconnect() end)
  102. pcall(function() Sound:Stop() end)
  103. pcall(function() Sound:Destroy() end)
  104. Clone:TweenPosition(UDim2.new(0.4,0,-0.3,0), "Out", "Quad", 0.2, true)
  105. if CorrectGuess then
  106. Notify("You guessed correctly :)")
  107. elseif Breakloop == true then
  108. Notify("Good try")
  109. else
  110. Notify("Too bad, you couldnt guess in time")
  111. end
  112. end
  113.  
  114. local function Preload()
  115. local Gui = GetPGui()
  116. if not Gui then return false end
  117. local PreloadG = GuiStore:findFirstChild("Preload")
  118. if not PreloadG then return end
  119.  
  120. local Clone = PreloadG:Clone()
  121. Clone.Parent = Gui
  122.  
  123. for i,v in pairs(Songs) do
  124. Game:GetService("ContentProvider"):Preload("http://www.roblox.com/asset/?id=" .. v.id)
  125. if Clone and Clone.Parent and Clone:FindFirstChild("Msg") then
  126. local Msg = Clone:findFirstChild("Msg")
  127. local percentage = (i / table.getn(Songs)) * 100
  128. Msg.Text = "Preloading sounds... Please wait " .. tostring(math.floor(percentage)) .. "%"
  129. end
  130. wait(.1)
  131. end
  132.  
  133. pcall(Game.Destroy,Clone)
  134. return true
  135. end
  136.  
  137. local function Start()
  138. local Current = Songs[math.random(1,#Songs)]
  139. PlaySound(Current.Name,Current.id)
  140. wait(2)
  141. Start()
  142. end
  143.  
  144. (function()
  145. if Preload() == true then
  146. Start()
  147. else
  148. local Msg = Instance.new("Message",Workspace.Camera)
  149. Msg.Text = "Error occured while preloading, please Message the owner(Nexure)"
  150. end
  151. end)()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement