zonda48
|
  |
| Joined: 13 May 2014 |
| Total Posts: 30 |
|
|
| 24 Mar 2015 07:04 AM |
I need a sound script for my speed run game.
If you have played speed run 4, you must know that the game has stage specific sound. I want a script like that for my game. I only pay (100R$) once you demonstrate and deliver your script. |
|
|
| Report Abuse |
|
|
| |
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 24 Mar 2015 07:37 AM |
This is my inefficient method: Put a local script into the StarterPack for the sound only to connect to a single client. Put a sound object into StarterPack too. Make sure this music is looped by checking the looped box in the music object.
local player = game.Players.LocalPlayer local Stage1Music = player.Backpack.Stage1Music if player.Stage.Value == 1 then Stage1Music:Clone().Parent = player while player.Stage1.Value == 1 do player.Stage1Music:Play() repeat wait() until player.Stage.Value > 1 player.Stage1Music:Stop() player.Stage1Music:Destroy() end elseif player.Stage.Value == 2 then --etc etc end
And then I just realized...What happens if a player dies? Well this script just got trashed... Unless if you fall off you teleport back to the Spawn. I would have to wipp out some player.Changed function too lazy to type.
|
|
|
| Report Abuse |
|
|
|
| 24 Mar 2015 07:44 AM |
@timeticks
I was thinking like he'd put the sounds into a model, loop through the model,
if their leaderstats 'stage' is the x then it plays that sound.
like this:
local leaderstats = game.Players.LocalPlayer:FindFirstChild("leaderstats") if leaderstats then if leaderstats:FindFirstChild("Stage") then local sounds = game["Sound Location"]:GetChildren() for x = 1, #sounds do if x == leaderstats.Stage.Value then local sound = sounds[x] local clone = sound:Clone() clone.Parent = game.Players.LocalPlayer.PlayerGui clone:Play() end end end end |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 24 Mar 2015 07:51 AM |
| I agree. Your method is much better than mine xD |
|
|
| Report Abuse |
|
|
zonda48
|
  |
| Joined: 13 May 2014 |
| Total Posts: 30 |
|
|
| 24 Mar 2015 08:21 AM |
| I should try the second script (Looping through models). |
|
|
| Report Abuse |
|
|
zonda48
|
  |
| Joined: 13 May 2014 |
| Total Posts: 30 |
|
|
| 24 Mar 2015 08:37 AM |
| Script is working good to an extent but whenever player goes to next level , sound for that level is not played unless player dies for first time. I think its due to leaderstats not fetching the level value in script. |
|
|
| Report Abuse |
|
|
|
| 24 Mar 2015 08:40 AM |
well,
that script is not fool-proof
first off, the sound never stops. second, when they get to the next stage it doesn't activate.
maybe a Stage.Value.Changed function? |
|
|
| Report Abuse |
|
|
zonda48
|
  |
| Joined: 13 May 2014 |
| Total Posts: 30 |
|
|
| 24 Mar 2015 08:42 AM |
| If you want to know the problem much better try to join the place 'soundtest11' in my places. There the some more issues with the script given by you. |
|
|
| Report Abuse |
|
|
|
| 24 Mar 2015 08:47 AM |
no errors, works perfectly.
well, if you don't count the double music.
hmmm |
|
|
| Report Abuse |
|
|
|
| 24 Mar 2015 08:52 AM |
let me know if it works.
local leaderstats = game.Players.LocalPlayer:FindFirstChild("leaderstats") if leaderstats then if leaderstats:FindFirstChild("Stage") then leaderstats.Stage.Value.Changed:connect(function() local sounds = game["Sound Location"]:GetChildren() for _,sound in pairs(game.Players.LocalPlayer.PlayerGui:GetChildren()) do if sound.ClassName == "Sound" then sound:Destroy() end end for x = 1, #sounds do if x == leaderstats.Stage.Value then local sound = sounds[x] local clone = sound:Clone() clone.Parent = game.Players.LocalPlayer.PlayerGui clone:Play() end end end) end end |
|
|
| Report Abuse |
|
|
CrowClaws
|
  |
| Joined: 04 Jul 2010 |
| Total Posts: 4466 |
|
|
| 24 Mar 2015 10:49 AM |
"Speed run 2"
Just stop. Make something original. |
|
|
| Report Abuse |
|
|
|
| 24 Mar 2015 10:51 AM |
| Originality isn't a thing on roblox, considering that most of the popular games on roblox are either, 1) From steam (Primarily garry's mod) or 2) Originally made very early in roblox. |
|
|
| Report Abuse |
|
|
CrowClaws
|
  |
| Joined: 04 Jul 2010 |
| Total Posts: 4466 |
|
|
| 24 Mar 2015 10:53 AM |
| But Speed run is already a popular thing. |
|
|
| Report Abuse |
|
|
zonda48
|
  |
| Joined: 13 May 2014 |
| Total Posts: 30 |
|
|
| 24 Mar 2015 12:21 PM |
| I am sleepy now, will try your script tomorrow. Thanks for your efforts for making the script again. Will let you know tomorrow. |
|
|
| Report Abuse |
|
|
zonda48
|
  |
| Joined: 13 May 2014 |
| Total Posts: 30 |
|
|
| 25 Mar 2015 05:43 AM |
Your updated script gives this error
"Players.Player.PlayerGui.LocalScript:4: attempt to index field 'Value' (a number value)"
What can be the problem?
|
|
|
| Report Abuse |
|
|
IoIiderp
|
  |
| Joined: 05 Feb 2012 |
| Total Posts: 8613 |
|
|
| 25 Mar 2015 05:55 AM |
Best scripted Speed Run I have seen is this: http://www.roblox.com/games/215212103/Speed-Run-Ultimate
You have no chance :P |
|
|
| Report Abuse |
|
|
|
| 25 Mar 2015 05:58 AM |
| k, that figures... going to have to loop. |
|
|
| Report Abuse |
|
|
IoIiderp
|
  |
| Joined: 05 Feb 2012 |
| Total Posts: 8613 |
|
|
| 25 Mar 2015 06:01 AM |
| put a wait() at the beginning of your script. |
|
|
| Report Abuse |
|
|
|
| 25 Mar 2015 06:07 AM |
@loli, well, if you insist.
wait() local leaderstats = game.Players.LocalPlayer:FindFirstChild("leaderstats") if leaderstats then if leaderstats:FindFirstChild("Stage") then while wait(0.1) do local sounds = game["Sound Location"]:GetChildren() for x = 1, #sounds do if x == leaderstats.Stage.Value then local sound = sounds[x] if not leaderstats.Parent.PlayerGui:FindFirstChild(sound) then for _,sons in pairs(game.Players.LocalPlayer.PlayerGui:GetChildren()) do if sons.ClassName == "Sound" then sons:Destroy() end end local clone = sound:Clone() clone.Parent = game.Players.LocalPlayer.PlayerGui clone:Play() end end end end end end |
|
|
| Report Abuse |
|
|
zonda48
|
  |
| Joined: 13 May 2014 |
| Total Posts: 30 |
|
|
| 25 Mar 2015 06:08 AM |
| wait() for ??? It won't do anything. Something has to be changed in the event call. |
|
|
| Report Abuse |
|
|
|
| 25 Mar 2015 06:12 AM |
um... isn't that what I did? I have to loop because there is no variable.Changed event.
but, yeah you can remove the wait() |
|
|
| Report Abuse |
|
|
IoIiderp
|
  |
| Joined: 05 Feb 2012 |
| Total Posts: 8613 |
|
|
| 25 Mar 2015 06:17 AM |
The wait() will just make sure everything has been loaded. Because if the FindFirstChild has returned false your script won't work. |
|
|
| Report Abuse |
|
|
|
| 25 Mar 2015 06:20 AM |
| well, I could just use :WaitForChild() |
|
|
| Report Abuse |
|
|
IoIiderp
|
  |
| Joined: 05 Feb 2012 |
| Total Posts: 8613 |
|
|
| 25 Mar 2015 06:21 AM |
| That would also work but the wait() is just easier to write \o/ |
|
|
| Report Abuse |
|
|