|
| 23 Jun 2013 07:32 PM |
When I press the play button it creates the sound with the ID and everything, but it doesn't play it!
local play = script.Parent.Play local pause = script.Parent.Pause local stop = script.Parent.Stop local playtime = script.Parent.TextLabel local sec = 00 local minute = 00 local hour = 00 pitchplus = script.Parent.PitchEditor.Plus1 pitchminus = script.Parent.PitchEditor.Minus1 pitch = script.Parent.PitchEditor.Pitch volumeplus = script.Parent.VolumeEditor.Plus1 volumeminus = script.Parent.VolumeEditor.Minus1 volume = script.Parent.VolumeEditor.Volume
play.MouseButton1Down:connect(function() local check = game.Soundscape:FindFirstChild("Sound") if not check then local id = script.Parent.idholder.Text s = Instance.new("Sound", game.Soundscape) s.SoundId = "http://roblox.com/asset/?id="..id s:Play() repeat wait(1) sec = sec + 1 if sec == 60 then sec = sec - 60 minute = minute + 1 if minute == 60 then minute = minute - 60 hour = hour + 1 end end playtime.Text = hour..":"..minute..":"..sec until s.Pitch == 0 else check.Pitch = pitch.Text repeat wait(1) sec = sec + 1 if sec == 60 then sec = sec - 60 minute = minute + 1 if minute == 60 then minute = minute - 60 hour = hour + 1 end end playtime.Text = hour..":"..minute..":"..sec until s.Pitch == 0 end end) pause.MouseButton1Down:connect(function() if s then s.Pitch = 0 end end) stop.MouseButton1Down:connect(function() if s then s:Stop() s:Destroy() s = nil playtime.Text = "0:0:0" sec = 00 minute = 00 hour = 00 end end) script.Parent.Pitch.MouseEnter:connect(function() script.Parent.Pitch.BackgroundColor3 = Color3.new(0,0,0) end) script.Parent.Pitch.MouseLeave:connect(function() script.Parent.Pitch.BackgroundColor3 = Color3.new(255,255,255) end) script.Parent.Pitch.MouseButton1Down:connect(function() script.Parent.Pitch.Visible = false script.Parent.PitchEditor.Visible = true end) script.Parent.Volume.MouseEnter:connect(function() script.Parent.Volume.BackgroundColor3 = Color3.new(0,0,0) end) script.Parent.Volume.MouseLeave:connect(function() script.Parent.Volume.BackgroundColor3 = Color3.new(255,255,255) end) script.Parent.Volume.MouseButton1Down:connect(function() script.Parent.Volume.Visible = false script.Parent.VolumeEditor.Visible = true end) script.Parent.LoopBool.MouseEnter:connect(function() script.Parent.LoopBool.BackgroundColor3 = Color3.new(0,0,0) end) script.Parent.LoopBool.MouseLeave:connect(function() script.Parent.LoopBool.BackgroundColor3 = Color3.new(255,255,255) end) script.Parent.LoopBool.MouseButton1Down:connect(function() script.Parent.LoopBool.Visible = false script.Parent.LoopBoolEditor.Visible = true end) pitchplus.MouseButton1Down:connect(function() s.Pitch = s.Pitch + .01 pitch.Text = s.Pitch end) pitchminus.MouseButton1Down:connect(function() local pitchcheck = s.Pitch if pitchcheck == .01 then s.Pitch = .01 elseif pitchcheck >= .2 then s.Pitch = s.Pitch - .01 end pitch.Text = s.Pitch end) script.Parent.PitchEditor.closepitch.MouseButton1Down:connect(function() script.Parent.PitchEditor.closepitch.Parent.Visible = false script.Parent.Pitch.Visible = true end) volumeplus.MouseButton1Down:connect(function() local volumecheck = s.Volume if volumecheck == 1 then s.Volume = 1 volume.Text = s.Volume elseif volumecheck < 1 then s.Volume = s.Volume + .01 volume.Text = s.Volume end end) volumeminus.MouseButton1Down:connect(function() local volumecheck2 = s.Volume if volumecheck2 >= .01 then s.Volume = s.Volume - .01 volume.Text = s.Volume elseif volumecheck2 == .01 then s.Volume = .01 volume.Text = s.Volume end end) script.Parent.VolumeEditor.closevolume.MouseButton1Down:connect(function() script.Parent.VolumeEditor.Visible = false script.Parent.Volume.Visible = true end) script.Parent.LoopBoolEditor.nocheck.MouseButton1Down:connect(function() script.Parent.LoopBoolEditor.nocheck.Visible = false script.Parent.LoopBoolEditor.check.Visible = true s.Looped = true end) script.Parent.LoopBoolEditor.check.MouseButton1Down:connect(function() script.Parent.LoopBoolEditor.check.Visible = false script.Parent.LoopBoolEditor.nocheck.Visible = true s.Looped = false end) script.Parent.LoopBoolEditor.closeloopbooleditor.MouseButton1Down:connect(function() script.Parent.LoopBoolEditor.Visible = false script.Parent.LoopBool.Visible = true end) |
|
|
| Report Abuse |
|
|
tigerr666
|
  |
| Joined: 13 Aug 2009 |
| Total Posts: 1665 |
|
|
| 23 Jun 2013 07:42 PM |
| Did you not read reesemcblox's post? You're not supposed to just post code, and expect us to fix it. |
|
|
| Report Abuse |
|
|
|
| 23 Jun 2013 07:46 PM |
| I didn't, read the top of it. |
|
|
| Report Abuse |
|
|
tigerr666
|
  |
| Joined: 13 Aug 2009 |
| Total Posts: 1665 |
|
|
| 23 Jun 2013 07:47 PM |
| Exactly, I did. But you just posted the whole thing, and expected us to find the problem and tell you ._. |
|
|
| Report Abuse |
|
|
|
| 23 Jun 2013 07:48 PM |
| Did you want me to narrow it down a little? |
|
|
| Report Abuse |
|
|
RoAnt
|
  |
| Joined: 14 Jul 2008 |
| Total Posts: 16794 |
|
|
| 23 Jun 2013 07:52 PM |
No output? Also, what's the soundID? Did you make sure it was a REAL sound? |
|
|
| Report Abuse |
|
|
|
| 23 Jun 2013 07:55 PM |
Yes I tested it with a real sound ID from the catalog and no there is no output. I used this ID:
2303479 |
|
|
| Report Abuse |
|
|
| |
|
RoAnt
|
  |
| Joined: 14 Jul 2008 |
| Total Posts: 16794 |
|
|
| 23 Jun 2013 08:14 PM |
Try inserting the sound in a player's head. I don't work with sounds but, try inserting it somewhere in Workspace. |
|
|
| Report Abuse |
|
|
RoAnt
|
  |
| Joined: 14 Jul 2008 |
| Total Posts: 16794 |
|
|
| 23 Jun 2013 08:15 PM |
Okay, I've tested it. Sound works for Workspace. |
|
|
| Report Abuse |
|
|
|
| 23 Jun 2013 08:54 PM |
| How would you return the player's name that clicked the button? |
|
|
| Report Abuse |
|
|
| |
|
RoAnt
|
  |
| Joined: 14 Jul 2008 |
| Total Posts: 16794 |
|
|
| 23 Jun 2013 09:40 PM |
Path from the button to the player. OR put all of this in a local script and make another variable.
Ex. (local script)
local player = game.Players.LocalPlayer |
|
|
| Report Abuse |
|
|
|
| 23 Jun 2013 09:50 PM |
| so, then I could use player.Character.Name to get it's name? |
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 23 Jun 2013 09:58 PM |
I did what you said but it still doesn't play the sound :( This is the revised script, it may seem shorter, but I just cut out the non-important stuff:
local play = script.Parent.Play local pause = script.Parent.Pause local stop = script.Parent.Stop local playtime = script.Parent.TextLabel local sec = 00 local minute = 00 local hour = 00 pitchplus = script.Parent.PitchEditor.Plus1 pitchminus = script.Parent.PitchEditor.Minus1 pitch = script.Parent.PitchEditor.Pitch volumeplus = script.Parent.VolumeEditor.Plus1 volumeminus = script.Parent.VolumeEditor.Minus1 volume = script.Parent.VolumeEditor.Volume
play.MouseButton1Down:connect(function() local player = game.Players.LocalPlayer.Character.Name local check = game.Workspace:FindFirstChild("Sound For"..player) if not check then local id = script.Parent.idholder.Text s = Instance.new("Sound", game.Workspace) s.Name = "Sound For"..player s.SoundId = "http://roblox.com/asset/?id="..id s:Play() repeat wait(1) sec = sec + 1 if sec == 60 then sec = sec - 60 minute = minute + 1 if minute == 60 then minute = minute - 60 hour = hour + 1 end end playtime.Text = hour..":"..minute..":"..sec until s.Pitch == 0 else check.Pitch = pitch.Text repeat wait(1) sec = sec + 1 if sec == 60 then sec = sec - 60 minute = minute + 1 if minute == 60 then minute = minute - 60 hour = hour + 1 end end playtime.Text = hour..":"..minute..":"..sec until s.Pitch == 0 end end) pause.MouseButton1Down:connect(function() if s then s.Pitch = 0 end end) stop.MouseButton1Down:connect(function() if s then s:Stop() s:Destroy() s = nil playtime.Text = "0:0:0" sec = 00 minute = 00 hour = 00 end end) |
|
|
| Report Abuse |
|
|
RoAnt
|
  |
| Joined: 14 Jul 2008 |
| Total Posts: 16794 |
|
|
| 23 Jun 2013 10:07 PM |
| Make the sound's parent into the Player's backpack. |
|
|
| Report Abuse |
|
|
|
| 24 Jun 2013 01:43 PM |
This script it in a local script:
local play = script.Parent.Play local pause = script.Parent.Pause local stop = script.Parent.Stop local playtime = script.Parent.TextLabel local sec = 00 local minute = 00 local hour = 00 pitchplus = script.Parent.PitchEditor.Plus1 pitchminus = script.Parent.PitchEditor.Minus1 pitch = script.Parent.PitchEditor.Pitch volumeplus = script.Parent.VolumeEditor.Plus1 volumeminus = script.Parent.VolumeEditor.Minus1 volume = script.Parent.VolumeEditor.Volume
play.MouseButton1Down:connect(function() player = game.Players.LocalPlayer local check = player.Backpack:FindFirstChild("Sound For "..player.Name) if not check then local id = script.Parent.idholder.Text s = Instance.new("Sound", game.player.Backpack) s.Name = "Sound For "..player.Name s.SoundId = "http://roblox.com/asset/?id="..id s:Play() repeat wait(1) sec = sec + 1 if sec == 60 then sec = sec - 60 minute = minute + 1 if minute == 60 then minute = minute - 60 hour = hour + 1 end end playtime.Text = hour..":"..minute..":"..sec until s.Pitch == 0 else check.Pitch = pitch.Text repeat wait(1) sec = sec + 1 if sec == 60 then sec = sec - 60 minute = minute + 1 if minute == 60 then minute = minute - 60 hour = hour + 1 end end playtime.Text = hour..":"..minute..":"..sec until s.Pitch == 0 end end) pause.MouseButton1Down:connect(function() if s then s.Pitch = 0 end end) stop.MouseButton1Down:connect(function() if s then s:Stop() s:Destroy() s = nil playtime.Text = "0:0:0" sec = 00 minute = 00 hour = 00 end end)
------------------------------------------------ But, I get this error when I press the play button:
12:42:34.426 - player is not a valid member of DataModel |
|
|
| Report Abuse |
|
|
| |
|
| |
|