|
| 13 Dec 2013 06:54 PM |
I want to make a script that, plays a background theme while in my menu but if the player clicks "PLAY" then the background theme will stop and scriptone and scripttwo will start to play the game's main music.
So Far I have:
while true do game.Workspace.soundfour:Play() wait(15) end
if script.Parent.MouseButton1Down:connect then game.Workspace.soundfour:Remove wait(5) game.Worksapce.scripttwo.Disabled=false and game.Worksapce.scriptone.Disabled=false end
I know it doesn't make sense but I need help. |
|
|
| Report Abuse |
|
|
|
| 13 Dec 2013 06:55 PM |
game.Workspace.soundfour:Remove to game.Workspace.soundfour:Remove()
|
|
|
| Report Abuse |
|
|
|
| 13 Dec 2013 06:58 PM |
Woops careless error. Thanks.
Now I know the line: if script.Parent.MouseButton1Down:connect then Doesn't make sense but I want a function to happen when the parent of script is clicked. |
|
|
| Report Abuse |
|
|
Eclipsin
|
  |
| Joined: 09 Feb 2012 |
| Total Posts: 5197 |
|
|
| 13 Dec 2013 07:03 PM |
Change that second group of lines to this:
function onClick() game.Workspace.soundfour:Remove() wait(5) game.Worksapce.scripttwo.Disabled=false and game.Worksapce.scriptone.Disabled=false end
script.Parent.MouseButton1Down:connect(onClick) |
|
|
| Report Abuse |
|
|
wuzzy33
|
  |
| Joined: 28 Jul 2012 |
| Total Posts: 69 |
|
|
| 13 Dec 2013 07:06 PM |
| I need help too I need a camera for my game its sort of like a cutscene and yeah I also need a CarBuy button but I'm not BC so I can't build cars Ive tried many things but they never work can someone help me? |
|
|
| Report Abuse |
|
|
|
| 13 Dec 2013 07:20 PM |
while true do game.Workspace.soundfour:Play() wait(15) end
function onClick() game.Workspace.soundfour:Remove() wait(5) game.Workspace.scripttwo.Disabled=false and game.Workspace.scriptone.Disabled=false <----says theres an unexpected symbol near "=" end
script.Parent.MouseButton1Down:connect(onClick)
|
|
|
| Report Abuse |
|
|
Slywarp
|
  |
| Joined: 12 Jul 2012 |
| Total Posts: 8 |
|
|
| 13 Dec 2013 07:42 PM |
The and operator only works for booleans, usage:
if a and b then
Only if both a and b are true will the if statement work. Your code should be:
while true do game.Workspace.soundfour:Play() wait(15) end
function onClick() game.Workspace.soundfour:Remove() wait(5) game.Workspace.scripttwo.Disabled = false game.Workspace.scriptone.Disabled = false end
script.Parent.MouseButton1Down:connect(onClick)
No and needed. It could also be:
while true do game.Workspace.soundfour:Play() wait(15) end
function onClick() game.Workspace.soundfour:Remove() wait(5) game.Workspace.scripttwo.Disabled, game.Workspace.scriptone.Disabled = false, false end
script.Parent.MouseButton1Down:connect(onClick) |
|
|
| Report Abuse |
|
|
|
| 13 Dec 2013 08:03 PM |
| scriptone's Disabled Boolean is the one that doesn't work? Because scripttwo's Disables Boolean works fine. |
|
|
| Report Abuse |
|
|
Slywarp
|
  |
| Joined: 12 Jul 2012 |
| Total Posts: 8 |
|
|
| 13 Dec 2013 08:11 PM |
| No, it's not the booleans themselves, it's the syntax in which you set them. You don't need an and in there. |
|
|
| Report Abuse |
|
|