How do I render things both client and server?

So you might now that RemoteEvents might take a little while to “activate”, so the way I want to remove the lag is rendering it both client and server. The client might see it 0.1 seconds faster before the server.

Thanks in advance :grinning:

1 Like

Anything on the server is rendered on the client. I don’t really get your question.

Anything in workspace should be replicated to both the server and client so long as it was created on the server. You can’t exactly get something created on the client over to the server without remote events, though.

What are you trying to “render”?
Whatever the server does will automatically replicate to the client.
But doing everything on the server is highly inefficient and can waste server resources.
In a lot of cases, it is still smart to use a remote event to trigger certain things like VFX and let just the client handle the workload.

You can’t really fix network latency. Its an inevitable here.

When you execute a script from the client, it doesn’t render it on the server, so only the client can see it.

Refer to @sparker22’s answer

You have to use remotes.

More simpler question:

For example a gun. I want to shoot a gun. When I use remote events, there’s a 0.1 second delay, then it fires. I want to do it both client and server, without delays. How do I do that?

You have to hide the network latency. So when you fire, you have the client create all of the visual effects and feedback. This makes it seem instant. You would then send information to the server to verify that your shot was legit and to tell other clients that you fired so they can see the VFX you saw. The delay between you seeing your shot and other players seeing your shot can’t be fixed.

1 Like

Well, some games, when someone (shoots/fires/does anything fired from client), it immediately “activates”. Any chance you know how to do that. If not, do you know how to get info from the client that’s different from the other clients?

I’m sorry if you’re confused, this is actually my first post.

Your interpretation of immediate activation is probably nothing but the fact that what you are being shown is occurring on the client. The delay you are referring, to my knowledge, cannot be removed because it is an innate part of replication. What games do you believe to do this?

I may try to find another way to do this, for example:

LocalScript:

function shoot()
    -- lets pretend somethings here
end

mouse.Activated:Connect(function()
    shoot()
    for i = 1,#game.Players:GetPlayers() do
        if game.Players:GetPlayers()[i].Name ~= player.Name then
            re:FireClient(info)
        end
    end
end)

I will try that, but if you use math.random() or BrickColor.Random, how do I get the info that’s replicated on the client?

I don’t want to fire it from my side, so that is why I am not using that.

I’m not sure I understand what you’re asking.

Sorry. I’ll figure out myself.

The point of scripting support is to receive help, no reason to be sorry :slight_smile:. I am just confused by what you are asking about that code. The delay that exists in RemoteEvent(s) is ever-present, and in most instances is not super noticeable.