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 |
|
|
|
| 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 |
|
|
|
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| Joined: 20 Jun 2014 |
| Total Posts: 824 |
|
|
| 11 Jul 2017 11:27 PM |
| One second, stay in the game ill explain everything. |
|
|
| Report Abuse |
|
|
|
| 11 Jul 2017 11:35 PM |
I think it has something to do with : Local player |
|
|
| Report Abuse |
|
|
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
|
  |
| Joined: 10 Sep 2011 |
| Total Posts: 2464 |
|
| |
|
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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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 |
|
|