Still have questions? Join our Discord server and get real time help.
0

Pole light not working, Keypress for local player doesnt work, help?

Edited 10 days ago

--Variables local player = game.Players.LocalPlayer local L1 = game.Workspace.Model.Lights.Light1 local L2 = game.Workspace.Model.Lights.Light2 local N1 = game.Workspace.Model.Neon1 local N2 = game.Workspace.Model.Neon2 --lights function a() if player.keypress.F then L1.Transparency = 0 L2.Transparency = 0 N1.Transparency = 0.1 N2.Transparency = 0.1 wait(0.5) L1.Transparency = 0.9 L2.Transparency = 0.9 N1.Transparency = 0.99 N2.Transparency = 0.99 wait(0.5) end end

I'm not sure why this isn't working, I tried to make it so when the player presses F, the pole lights will turn on then off, yet when I try it, it doesn't seem to work and there aren't any errors shown in output.

0
It's because player doesn't have a keypress property. Use the UserInputService. MCAndRobloxUnited 1517 — 10d

0
local UserInputService = game:GetService('UserInputService')

UserInputService.InputBegin:Connect(function(input) -- Fire when a client press any key or mouse buttons; return "input" table
if input.UserInputType == Enum.UserInputType.Keyboard then -- Check if the input type is fire by the keyboard
if input.KeyCode == Enum.KeyCode.E then -- Check if the key is "E"