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

How can I make a server script do stuff only locally?

Asked by 4 years ago
Edited 4 years ago

I am trying to make a server script do things only locally. Is this possible and how I could do it? I have already tried to put local at function parts of a script but it seems to not work.

1
Why do you need to use a server script to do this? Why not just use a LocalScript? cowsoncows 951 — 4y
0
u can use a remote event and fireclient HappyTimIsHim 652 — 4y

1 answer

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

For a serverscript itself to do things locally, no it's not possible. It runs on the server and anything it does replicates.

There are several workarounds like what HappyTimIsHim stated :FireClient() , or just flat out use a localscript.

Local is mostly used to create variables in the context of the line.

What i mean by context of the line:

local var1 = "yay"

if var1 = "yay"
    local var1 = "sad"
    print(var1) -- returns sad
end

print(var1) -- Returns yay

Example 2:

local var1 = "yay"

if var1 = "yay"
    var1 = "sad"
end

print(var1) -- Returns sad
Ad

Answer this question