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: My script works in Play Solo...

Previous Thread :: Next Thread 
pearman is not online. pearman
Joined: 05 Jun 2009
Total Posts: 1681
28 Jul 2013 12:29 PM
local transitionSound = Instance.new("Sound", game.Workspace)
transitionSound.Volume = 2
transitionSound.Pitch = 1
transitionSound.Name = "transitionSound"
transitionSound.SoundId = "rbxasset://sounds/clickfast.wav"

local gameMusic = Instance.new("Sound", game.Workspace)
gameMusic.Volume = 2
gameMusic.Pitch = 1
gameMusic.Name = "gameMusic"
gameMusic.SoundId = "http://www.roblox.com/asset/?id=11231513"
gameMusic.Looped = true

function Startup(player)

--[[ Create the GUI ]]--

MyGUI = Instance.new("ScreenGui", player.PlayerGui)
MyGUI.Name = "StartupGUI"

--[[ Create our frame ]]--

MyFrame = Instance.new("Frame", MyGUI)
MyFrame.Size = UDim2.new(0, 600, 0, 150)
MyFrame.Position = UDim2.new(0.5, -291, 0.5, -328)
MyFrame.Style = "RobloxRound"
MyFrame.Active = true
MyFrame.Draggable = true
MyFrame.BackgroundColor3 = Color3.new(0,0,0)

--[[ Create our textlabel ]]--

MyTextLabel = Instance.new("TextLabel", MyFrame)
MyTextLabel.Size = UDim2.new(1, 0, 1, 0)
MyTextLabel.BackgroundTransparency = 1 -- invisible = 1
MyTextLabel.TextColor3 = Color3.new(1,1,1)
MyTextLabel.TextScaled = true
MyTextLabel.Font = "ArialBold"
MyTextLabel.FontSize = "Size36"
MyTextLabel.Text = "Welcome!"

if game.Workspace.IsStartup.Value == true then
script.Parent.IsStartup.Value = false
end
end

function ChangeGui(player)
while IsStartup == true do wait(2) end
--[[ Tell the user information about the game ]]--
player.PlayerGui.StartupGUI.Frame.TextLabel.Text = "This game was made by pearman!"
transitionSound:Play()
wait(2)
player.PlayerGui.StartupGUI.Frame.TextLabel.Text = "This project is currently top-secret!"
transitionSound:Stop()
transitionSound:Play()
wait(2)
transitionSound:Stop()
transitionSound:Play()
player.PlayerGui.StartupGUI.Frame.TextLabel.Text = "Welcome!"
wait(2)
transitionSound:Stop()
end

function PlayGameMusic()
--[[ Play music in the background for the game ]]--

if game.Workspace.IsMusicPlaying.Value == false then
gameMusic:Play()
game.Workspace.IsMusicPlaying.Value = true
end
end

game.Players.PlayerAdded:connect(Startup)

for i, v in pairs(game.Players:GetChildren()) do
Startup(v)
ChangeGui(v)
PlayGameMusic()
end

What's wrong with it that makes it not work in a regular server?
Report Abuse
bigdaddy92 is not online. bigdaddy92
Joined: 17 Jan 2010
Total Posts: 1684
28 Jul 2013 12:30 PM
add

wait()

at the top of the script, before anything.
Report Abuse
pearman is not online. pearman
Joined: 05 Jun 2009
Total Posts: 1681
28 Jul 2013 12:34 PM
Didn't work, but wait(10) did. The sounds got messed up though. Is there a way to make it so it will wait until everything loads properly?
Report Abuse
bigdaddy92 is not online. bigdaddy92
Joined: 17 Jan 2010
Total Posts: 1684
28 Jul 2013 12:35 PM
When accessing an instance, do it like this:

Instead of this:

local something = script.Parent
local somethingElse = something.blah

do this:

somethingElse = something:WaitForChild("blah")


That may help you.

Are you using this as a localscript, and where is it parented?
Report Abuse
pearman is not online. pearman
Joined: 05 Jun 2009
Total Posts: 1681
28 Jul 2013 01:18 PM
I'm using it as a regular script in Workspace.
Report Abuse
pearman is not online. pearman
Joined: 05 Jun 2009
Total Posts: 1681
28 Jul 2013 01:56 PM
Also, I used WaitForChild to make sure everything got loaded, but only the GUI showed up in public mode, nothing else happened.
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