Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

What is a server sided script? And how do you make one? Nothing has worked.

Asked by 2 years ago

……………………….. ……………………….. ……………………….. ……………………….. ……………………….. ……………………….. ……………………….. ………………………..

3 answers

Log in to vote
0
Answered by 2 years ago
Edited 2 years ago

On Roblox, there's Filtering Enabled. Which is Client & The Server itself.

Client is the players itself, & The servers is the game itself.

FOR EXAMPLE.

There's some random bozo using an exploit. He deleted the Baseplate, & he thought everyone going to fall off. But, instead. He's the only one who fell off from the Baseplate.

Basically, on his screen the Baseplate got vanished A.K.A Gone / Destroyed / Deleted. But, in the other people screen... the baseplate is still there.

& the real question from that bozo is WHY?!*

It's because, he only deletes baseplate only on his client. Not from the server itself.

Now let's go to the point,

You can use Remote Event & Functions to COMMUNICATE within the Clients & The Server.

Now, you may be asking? What the hell is Remote Event & Functions?

Let's start with Remote Functions.

Remote Functions are somewhat like this (Thank you CatMeowDev for the inspiration):

When thinking to yourself, you are using a local script. When you talk, its a normal script.

My thoughts can be turned into speech with a remote function, BUT I can't continue thinking while speaking. I can only continue to think once I'm done speaking.

EXAMPLE of using the Remote Functions:

  1. Insert a Part, in the workspaces
  2. Insert a Remote Functions into ServerStorage & Name it DeletePartFunction
  3. Insert a Script in the ServerScript
  4. Insert a Local Script in Starter Player, StarterPlayerScript
  5. Now write these on the Local Script
local RS = game:GetService("ReplicatedStorage") -- Using GetService so, it doesn't error.
local DPFunction = RS:WaitForChild("DeletePartFunction") -- Waiting for the Communicator to load.

local UIS = game:GetService("UserInputService") -- Get UserInputService, this like used for hotkeys / Ex: Prees Z to use Fireball.

local Part = game.Workspace.Part -- Get the part in the workspaces

UIS.InputBegan:Connect(function(input) 
    if input.KeyCode == Enum.KeyCode.Delete then -- If a player press delete button then
        DPFunction:InvokeServer(Part) -- Communicate with the server & inside of the (Is parameter).
print("Sussy Baka AMOGUS :)") -- Print Sussy baka yes.
    end
end)

Now write down these in the ServerScriptService, Script.

local RS = game:GetService("ReplicatedStorage") -- GetService ReplicatedStorages, so it doesn't error instead of game.ReplicatedStorage which gives error sometimes.
local DPFunction = RS:WaitForChild("DeletePartFunction") -- Wait for the communicator to load

DPFunction.OnServerInvoke = function (player, part) -- THE FIRST ONE Always be player, then the second is a parameter.
    part:Destroy() -- Destroy the part
    wait(3) -- After the codes did all of the jobs, it'll print Sussy Baka on from the local script.
end

Now, if you hit play & click Delete it should delete the part & print sussy baka after 3 seconds. & It's going to delete the part on the server. & Other ppl can see that the part is destroyed. But, if you're only using local script and only write down Part:Destroy() It'll only be destroyed from the client itself & In the server, the part is still there.

I Recommend you to watch TheDevKing & other ytbers Advanced tutorials about those, if you still confused. You can also, read the Developer Hub from the roblox itself.

P.S I'm just a beginner scripter, that still doesn't know about lua that much lol. I also don't know, how exploiter abuse the Remote Events & Functions.

So... CORRECT ME IF I'M WRONG, Peace!

Ad
Log in to vote
0
Answered by
Antelear 185
2 years ago

Workspace, ServerScriptService, ServerStorage and maybe a couple more support server sided scripts. Those happen on server side (which means it happens on everybody's screen). The opposite is client-sided (where it only happens on a specfic player's screen).

Hope this helped lol

0
That isn't a detailed answer. JesseSong 3916 — 2y
Log in to vote
0
Answered by 2 years ago

Hello everyone! Since most people don’t have the best answers, here is the best answer that you should listen to. 1: A server script means that it’s either something that is inside of your game or is not a local script 2: what the hell is a local script? A local script can only run on 1 players screen. Because it’s a ”local” script. In fact, you can only use it for certain things! You may only use it under the following conditions: The local script is in starterGui. It’s in replicated storage. Under a players backpack. 3: Wow! But, how can I communicate from the server to the client? Easy. Use a remote event, specify it, then say :Fire() then, in another script say: :OnEventFire()

I hope this helped you. If you enjoyed, upvote this!

Answer this question