Why are scripts that are working perfectly fine in studio solo mode not even working in regular game mode?
If you have filtering enabled, scripts behave differently in studio than they do in-game.
This would be kind of complicated to answer completely.
In short, in Play Solo you run as the server and the client. In a live game or in Test Server/Test Player, you run as only the server or the client.
The server can do certain things that only the server is allowed to do. The server is the “boss” and all the clients have to pass through it. The server, besides helping clients talk to each other, also prevents cheating.
The clients are likely what you think of as “Roblox” – they’re the game you see on your screen. When you join a game, you are a client. So are all the other players playing with you. As the client, only you can see changes that you make to the game. If you want to make changes other players can see, you have to ask the server using RemoteEvents or RemoteFunctions. Having to ask the server is one way that Roblox prevents cheating.
Here are a few examples of things that only the server is allowed to do:
- Make changes to the game that everyone sees.
- Spawn players
- Load maps
- Change the lighting for everyone
- Set the network ownership of parts
- Kick players
- Send global chat messages
- Access Data Stores
- Access HttpService
- Create and modify Terrain
- Create and modify collision groups
- Filter chat messages
- Listen to and send from the server-side of Remotes
- …and more.
Here are a few examples of things that only the client is allowed to do:
- Do things on every render frame
- Listen for user input such as key presses, mouse movement, screen touches, or controller button presses
- Show things to only their own client. That is local, player-only effects.
- Manipulate the camera
- Play character animations
- Display and use GUIs
- Handle character and vehicle movement
- Listen to and send from the client-side of Remotes
- …and more.
Both are a very important part of making a game, and the server/client split is very important for preventing cheaters.
If your scripts are working in Play Solo but not online or in Start Server/Start Play test, then it’s because you’re either using a client thing on the server or a server thing on the client. You need to understand what things are client-only and what things are server-only to fix your problem.
If you’re having a specific issue, it would help if you describe it in more detail. With more detail, we could describe what thing you’re using on the server or client incorrectly, and how you can structure your code to fix it.
To use server-side features, you use a Script. To use client-side features, you use a LocalScript. You can only run LocalScripts from…
- PlayerScripts (StarterPlayerScripts)
- The Character (StarterCharacterScripts)
- The PlayerGui (StarterGui)
- The Backpack (Starterpack)
If you need to share code between Scripts and LocalScripts, you can use ModuleScripts. ModuleScripts run separately on the server and on the client, but they have the same code on each. You have to require()
them to use them. ModuleScripts can be a bit complicated at first. The ModuleScript wiki page has a few examples, and you can find many examples in public models and on these developer forums.
There is a small exception to some of these: experimental mode. You do not want to use experimental mode – it lets cheaters and exploiters do anything, including delete your whole game out from under your players’ feet! Because of this, and other related reasons, experimental mode games cannot be featured and do not show up on the Games page for many users.
With that being said, experimental mode lets you change things for all players from clients. It does not let you do most server things from the client, it only lets you make property changes that everyone will see. Things like Data Stores, HttpService, collision groups, and global chat messages are still locked to server-only.
Experimental mode makes things a bit easier, but has major downsides! Experimental mode is the reason that Roblox had a significant amount of exploits and exploiters for years. You don’t want that in your game.
Some of these explanations have been simplified to help understanding. Eventually, with practice and experience, you’ll understand these things in more detail.
Can you fire server from a local script in startergui, on button click but have it postasync to trello?
Yes, you can call :FireServer
from a LocalScript.
When the script runs, it will actually be in the player’s PlayerGui. Otherwise, yes.
Assuming you connect to the button click event from the LocalScript, yes.
Assuming you do this on the server-side of the RemoteEvent with a Script (listening to OnServerEvent
), yes.
If you’re having trouble with this, then make sure that you’re looking at the output for any errors online. If you don’t see any, then start adding print
statements at parts of your code you suspect might be the problem.
To test with a server/client environment in Studio, you can use the Start Server button:
Online, you can access the output by pressing the F9 key, which opens up the Developer Console.