Blackout with SetArtificialLightsState

SetArtificialLightsState work only to my character, another players see light.
On server side, SetArtificialLightsState - not work

Hey,

This native is specifically client-sided. Client is rendering all the lights and what not, so you’ll have to update this state with every player.
Below is an example:
Server

local state = false
RegisterCommand("changestate", function(source)
    --if HasPerms(source) then
        state = not state
        TriggerClientEvent("changestate:state", -1, state)
    --end
end)

Client

RegisterNetEvent("changestate:state", function(state)
    SetArtificialLightsState(state)
end)

And that’s about it.

1 Like

Its work only for me.
Another player see light.

Hi there, try to take a look here: Need help for one Native (SetArtificialLightsState AffectsVehicles)

Also I tried it in the past with the game build that they wrote there and it worked for me.

1 Like

You can mark my last message as a solution if it worked for you :wink:.

same problem,
for me - its work
for another players - all normal

Can you share your code?
So i can help as soon as i can.

client.lua


RegisterKeyMapping('active2', 'activate 2', 'keyboard', 'F3')


RegisterCommand('active2', function()
	power_2_active = not power_2_active

		if power_2_active then
			while power_2_active do
				Wait(0)
				SetArtificialLightsState(true)
			end
		end
		
	end
end)