This tutorial should help you help others script on the devforum. If the writer has not specified the type of script they are showing… this will give you clues on what to look for to tell if a script is server sided, or client sided. Then, you won’t have to ask the writer yourself!
I see people asking all the time, when clearly it’s one or the other. That’s the motivation behind this tutorial!
Client Sided Script?
If you see one of these lines, it is definitely client sided:
game.Players.LocalPlayer
game:GetService("UserInputService")
game.ContextActionService
game:GetService("RunService").RenderStepped
game.StarterGui:SetCoreGui()
game.StarterGui:SetCoreGuiEnabled()
game.GuiService
game.VRService
game.ContentProvider
RemoteEvent.OnClientEvent:Connect()
RemoteFunction.OnClientInvoke = function()
Server Sided Script?
If you see one of these lines, it is server sided:
game.HttpService
game.ServerScriptService
game.ServerStorage
game:GetService("DatastoreService")
game:GetService("MessagingService")
game:GetService("MemoryStoreService")
Instance.new("RemoteEvent")
Instance.new("RemoteFunction")
RemoteEvent.OnServerEvent:Connect()
RemoteFunction.OnServerInvoke = function()
game:BindToClose()
-- Possible on client, most likely on server:
game.Players.PlayerAdded
game.Players.PlayerRemoving
player.Chatted
player:Kick()
-- Possible on client, only makes sense on server:
Object.Parent = game.ReplicatedFirst
Object.Parent = game.ReplicatedStorage
Object.Parent = game.StarterPack
Object.Parent = game.StarterGui
Module Scripts
I don’t say ‘server script’ or ‘LocalScript’ because of modules. They can be run both on the server and client. If you have not tried object oriented programming, I strongly recommend it, even if you’re new (but not brand new) to scripting!
However, if you see a server sided line AND a client sided line in the same script, you should ask the writer what type of script it is.
For example, this code is wrong:
local player = game.Players.LocalPlayer
local objects = game.ServerStorage
It’s most likely client sided, and the writer tries to use ServerStorage incorrectly.
local DSS = game:GetService("DatastoreService")
local UIS = game:GetService("UserInputService")
It’s most likely server sided. DatastoreService is only available on the server, you get the point.
If there are no clues on what type of script it is, then maybe go off of what the writer is trying to make. It’s less reliable though, they could be new and not know the difference between the server and the client.
You’re the Writer?
If you’re the one posting code, you should take a few seconds to say what type of script it is to invalidate this tutorial completely. There’s a few different ways I’d go about it.
You wouldn’t need to do this if your changing somebody else’s script, since they already know what the type is.
Writer Examples
Here’s my code! Why is it erroring?
-- Client Sided: local player = game.Players.LocalPlayer -- other code
Here’s the code:
-- Server Sided: local templates = game.ServerStorage.Templates -- other code
I need help with my datastore system! It’s a running server sided in a module.
local Shop = {} -- other code return Shop
Replace that code with this:
return a + (b - a) * delta
It wasn’t working before because you were dividing instead of multiplying!
Hopefully now you can identify quickly what type of script somebody sent!
Thanks for reading.