So basically I am adding a function light on my helmet. To do so when pressed L key it fire an event which enable the light on the server (in theory)
local meep = game:GetService("ContextActionService") local ReplicatedStorage = game:GetService("ReplicatedStorage") local player = game.Players.LocalPlayer function keypress(actionName, inputState, inputObj) if inputState == Enum.UserInputState.Begin then if player.Character.Helmet:FindFirstChild("HelmetLight") then game.ReplicatedStorage.HelmetLight:FireServer() end end end game.ContextActionService:BindAction("BoundAction", keypress, false, Enum.KeyCode.L)
This is the local script.
local ReplicatedStorage = game:GetService("ReplicatedStorage") game.ReplicatedStorage.HelmetLight.OnServerEvent:connect(function(player) print(player.Name) if player.Character.Helmet.HelmetLight.Light.L1.Enabled == false then print("hello there") player.Character.Helmet.HelmetLight.Light.L1.Enabled = true player.Character.Helmet.HelmetLight.Light.L2.Enabled = true else print("bye there") player.Character.Helmet.HelmetLight.Light.L1.Enabled = false player.Character.Helmet.HelmetLight.Light.L2.Enabled = false end end)
This is the server script. Everything is fine until there. The server script give me this error:
23:32:13.589 - Helmet is not a valid member of Model 23:32:13.590 - Stack Begin 23:32:13.590 - Script 'ServerScriptService.HelmetLight', Line 9 23:32:13.590 - Stack End
No idea why it does that. Any idea?
Didn't test properly, in "test play" the helmet was only on the client, unlike in a proper server, which explain why the server script couldn't find the helmet.