generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Does not function properly

Previous Thread :: Next Thread 
froggodude is not online. froggodude
Joined: 22 Sep 2012
Total Posts: 1638
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 is not online. 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
froggodude is not online. froggodude
Joined: 22 Sep 2012
Total Posts: 1638
23 Jun 2013 07:46 PM
I didn't, read the top of it.
Report Abuse
tigerr666 is not online. 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
froggodude is not online. froggodude
Joined: 22 Sep 2012
Total Posts: 1638
23 Jun 2013 07:48 PM
Did you want me to narrow it down a little?
Report Abuse
RoAnt is not online. 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
froggodude is not online. froggodude
Joined: 22 Sep 2012
Total Posts: 1638
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
froggodude is not online. froggodude
Joined: 22 Sep 2012
Total Posts: 1638
23 Jun 2013 08:12 PM
bump
Report Abuse
RoAnt is not online. 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 is not online. 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
froggodude is not online. froggodude
Joined: 22 Sep 2012
Total Posts: 1638
23 Jun 2013 08:54 PM
How would you return the player's name that clicked the button?
Report Abuse
froggodude is not online. froggodude
Joined: 22 Sep 2012
Total Posts: 1638
23 Jun 2013 09:38 PM
bump
Report Abuse
RoAnt is not online. 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
froggodude is not online. froggodude
Joined: 22 Sep 2012
Total Posts: 1638
23 Jun 2013 09:50 PM
so, then I could use player.Character.Name to get it's name?
Report Abuse
notsopwnedg is not online. notsopwnedg
Joined: 07 Nov 2010
Total Posts: 4182
23 Jun 2013 09:50 PM
or just player.Name
Report Abuse
froggodude is not online. froggodude
Joined: 22 Sep 2012
Total Posts: 1638
23 Jun 2013 09:53 PM
ok
Report Abuse
froggodude is not online. froggodude
Joined: 22 Sep 2012
Total Posts: 1638
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 is not online. 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
froggodude is not online. froggodude
Joined: 22 Sep 2012
Total Posts: 1638
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
froggodude is not online. froggodude
Joined: 22 Sep 2012
Total Posts: 1638
24 Jun 2013 02:02 PM
bump
Report Abuse
froggodude is not online. froggodude
Joined: 22 Sep 2012
Total Posts: 1638
24 Jun 2013 02:21 PM
bump
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image