So I have a local script in startergui:

local UIS = game:GetService("UserInputService") local Reasure = 'Running'

UIS.InputBegan:Connect(function(input, gameProcessedEvent) if input.UserInputType == Enum.UserInputType.Keyboard then if input.KeyCode == Enum.KeyCode.F then print(Reasure) end end end)

so what it basically does is it is supposed to activate and deactivate a light(the light is a spotlight in a part named light called L1) in a StarterCharacter model I have made. I want the light to deactivate but I don't know how to script it. The StarterCharacter model is in StarterPlayer and I tried this line of script:

local Light = game.StarterPlayer:WaitForChild("StarterCharacter")

but then I don't how to include the Light so then I tried this:

local Light = game.StarterPlayer.StarterCharacter.Light.L1

so then later on I added a keybind:

if Input.KeyCode == Enum.KeyCode.F then Light.Enabled = false
end

but it doesn't work so does FindFirstChild so i need help. Thx for reading.

3 comments

0

Likely because it's client-sided. Try this on the server using a RemoteEvent or RemoteFunction.

0

CODE BLOCK.

0

but im also not sure which line of code is right though