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 » Scripters
Home Search
 

Re: Main reason scripts only work in studio?

Previous Thread :: Next Thread 
Ueskay is not online. Ueskay
Joined: 20 Jun 2014
Total Posts: 824
11 Jul 2017 10:41 PM
Ever since a roblox update about 2 years ago destroyed my game.
I had given up on it entirely until now.

Nearly all of my GUI scripts don't work outside of Studio.
My question is, what is the main reason this happens?
What can i do to fix it?
Report Abuse
BunnyBoy26 is not online. BunnyBoy26
Joined: 17 Jun 2010
Total Posts: 5674
11 Jul 2017 10:45 PM
anything that has to do with a single player only (e.g. GUIs) should be done in a LocalScript.
The main reason for this issue is that in Play Solo, everything is on the client, but in a real server you must maintain the client/server duality.
Report Abuse
McRocketNuggets is not online. McRocketNuggets
Joined: 23 Nov 2016
Total Posts: 472
11 Jul 2017 10:58 PM
In roblox studio, when you test it your player acts as the server. With this in mind, you can do things locally in a server script since your player is the server, but outside of studio it wouldn't work since the players are not the server. I basically summed it up :)
Report Abuse
vastqud is not online. vastqud
Joined: 10 Sep 2011
Total Posts: 2464
11 Jul 2017 11:05 PM
i would recommend adding a wait(1) at the top of all of your gui scripts. i just made a gui script that only worked in studio, but once i added the wait(1) to the top, it worked in game as well.

also make sure that most everything to do with guis is a localscript.


Report Abuse
Ueskay is not online. Ueskay
Joined: 20 Jun 2014
Total Posts: 824
11 Jul 2017 11:20 PM
Here is a copy of my GUI.

Please tell me what's wrong with it.
i can't focus enough to diagnose the problem.


Link: https://www.roblox.com/library/912170272/MenuGUI

And please, if you take the model.
I would prefer if you don't use it..
I made it specifically for my personal use.
Report Abuse
vastqud is not online. vastqud
Joined: 10 Sep 2011
Total Posts: 2464
11 Jul 2017 11:24 PM
what exactly is wrong with it in-game? i played your game and everything seems to be working fine.


the only thing that i can find that could be a problem is that you dont have a wait at the top. again, i just made a gui script similar to this and it didnt work in-game until i put a wait(1) at the top.


Report Abuse
Ueskay is not online. Ueskay
Joined: 20 Jun 2014
Total Posts: 824
11 Jul 2017 11:27 PM
One second, stay in the game ill explain everything.
Report Abuse
LegomasterNiko is not online. LegomasterNiko
Joined: 27 Feb 2013
Total Posts: 1176
11 Jul 2017 11:35 PM
I think it has something to do with :
Local player
Report Abuse
cabbler is not online. cabbler
Joined: 19 Jun 2015
Total Posts: 735
11 Jul 2017 11:54 PM
You're not supposed to "wait(1) at the top" you are supposed to WaitForChild everything cus the client has to load
Report Abuse
vastqud is not online. vastqud
Joined: 10 Sep 2011
Total Posts: 2464
11 Jul 2017 11:55 PM
works for me


Report Abuse
vastqud is not online. vastqud
Joined: 10 Sep 2011
Total Posts: 2464
11 Jul 2017 11:56 PM
actually, you're right but im just too lazy to do that so i chose to go the simpler route and just wait for them all to load in with that wait(1)


Report Abuse
Zawie is not online. Zawie
Joined: 04 Jul 2010
Total Posts: 6338
12 Jul 2017 12:11 AM
@vast
but it's also not really good
bc if someone has bad internet or for some reason it slows when they join, it might take more ethan 1 second for things to appear.
Very unlikely, but you aren't protecting against that edge case.
Report Abuse
vastqud is not online. vastqud
Joined: 10 Sep 2011
Total Posts: 2464
12 Jul 2017 12:13 AM
well, its still an easy fix for me for whenever i decide to stop being lazy and do it.

its not that big of a deal, seeing as i know the potential consequences of just using wait instead of waitforchild


Report Abuse
cabbler is not online. cabbler
Joined: 19 Jun 2015
Total Posts: 735
12 Jul 2017 12:14 AM
exactly. If you hate typing it out...

wfc = game.WaitForChild
wfc(script.Parent,'Frame')
etc
Report Abuse
Ueskay is not online. Ueskay
Joined: 20 Jun 2014
Total Posts: 824
12 Jul 2017 12:35 AM
I've got a new error.

Here is the script:

local player = game.Players.LocalPlayer
local char = game.Workspace:WaitForChild(player.Name)
local price = 2000
object = game.ServerStorage.Shipments.AK47SHIP
x = object:Clone()

function onClicked()
if player:findFirstChild("leaderstats") then
if player.leaderstats.Money.Value >= price then
player.leaderstats.Money.Value = player.leaderstats.Money.Value - price
x.Parent = game.Workspace
x.Position = char.Torso.CFrame + CFrame.new(1,0,0)
script.Parent.Sound:Play()
end
end
end
script.Parent.MouseButton1Click:connect(onClicked)


Here is the error:

ServerStorage is not a valid member of DataModel
Line 4
Report Abuse
vastqud is not online. vastqud
Joined: 10 Sep 2011
Total Posts: 2464
12 Jul 2017 12:54 AM
Is it a localscript? If so, I don't think that you can access server storage from a localscript.
Report Abuse
Ueskay is not online. Ueskay
Joined: 20 Jun 2014
Total Posts: 824
12 Jul 2017 01:00 AM
what can i access it by then?
im confused about this.
Report Abuse
Inductive is not online. Inductive
Joined: 28 May 2012
Total Posts: 6480
12 Jul 2017 01:02 AM
You can access it from the server, but not from the client.

This means that you're going to have to store your stuff somewhere else.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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