Is the client able to access information from the server?

I need someone to help me answer this question for a project I have been making. If I did this LOCAL SCRIPT, Would it work?

local MovingOrNot = script.Parent.MovingOrNot
while true do
        if MovingOrNot.Value = "Moving" then
                Base.Velocity = Vector3(40,0,0)
        else
                Base.Velocity = Vector3(40,0,0)
end

So basically, I want the local script to set thee base’s velocity on the client depending on what value “MovingOrNot” is on the server. I am wondering if the local script WOULD WORK and be able to get the MovingOrNot value from the server and able to change the bases velocity.

1 Like

I’d advise using a string value or other and placing that in ReplicatedStorage, you can’t access ServerScriptService from the client.

What is Base in the script? Once that context is provided, I can make a decision.

The short answer is: Yes. You cannot get values from remote events, but you can get values from remote functions.
For example,
-Server script (RemoteEvent):

game.ReplicatedStorage.RandomEvent.OnServerEvent:Connect(function(self,...)
return {...}; -- output: nil
end)

If we fire this from the client, it will return nil.
Otherwise if it was a RemoteFunction, it would be

game.ReplicatedStorage.RandomFunction.OnServerInvoke = function(self, ...)
return {...}; -- output: table: ...
end)

When you fire it on client, you will get a table. Make sure that the remote function you fired was set in a variable, example: local returned = game.ReplicatedStorage.Whatever:InvokeServer(...); print(returned)

Firstly, it would cause immense lag as there is no wait statement inside the while true loop. Secondly, the local script would make it look like the velocity is changing, but only for the client. It would be much better to use a server script.

just a part 30charrrrrrrrrrrr sorry for the long reply, my internet went down