Jump to content

Recommended Posts

what exactly do you want to know?

components are controlled by server to 99% (some like "talker" are also at clients, cause they do display text)
So if you try to access components, you have to make sure that this code is only executed at server.
To find out in a script who executes it, you can use this small script from Maris aka star:

 

local SERVER_SIDE = nil
local DEDICATED_SIDE = nil
local CLIENT_SIDE = nil
local ONLY_CLIENT_SIDE = nil
-- code from star:
-- Also notice that if SERVER_SIDE is nil and CLIENT_SIDE is nil too, that means the mod is force enabled and its working on main screen. I guess. 
if GLOBAL.TheNet:GetIsServer() then
	SERVER_SIDE = true
	if GLOBAL.TheNet:IsDedicated() then
		--Нельзя использовать GetServerIsDedicated, т.к. это лишь сообщает о сервере, а не о текущей машине.
		--Хотя... Не суть. Все равно же проходим через GetIsServer.
		DEDICATED_SIDE = true
	else
		CLIENT_SIDE = true --А это оригинальное решение вечной проблемы "ismastersim".
		--Следует использовать только для инициализации сетевых переменных, не совмещая с "return" выходом из префаба!!
	end
elseif GLOBAL.TheNet:GetIsClient() then
	SERVER_SIDE = false
	CLIENT_SIDE = true
	ONLY_CLIENT_SIDE = true
end

then you can use in your code "if SERVER_SIDE then"

Edited by Serpens

Components are ran server side, unless they are specific components like the talker. Replicas are 'components' that run with limited functionality on the client side. You can get a lot of details from the replicas of an entity on the client-side.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...