Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why wont this work?

I made a script that on "f" pressed turns on SpotLight, the problem is when I use key == "f" it doesn't work and when I use key:byte() == 50 (etc.) it does.. Here's script

script.Parent.ChildAdded:connect(function()
	if mouse == nil then
		Player = game.Players.LocalPlayer
		mouse = Player:GetMouse()
	end
mouse.KeyDown:connect(function(key)
	

	local Left = script.Parent.Parent.Lights.FL.FLL
	local Right = script.Parent.Parent.Lights.FR.FRL
	key = key:lower()
		if key == "f" and Left.Enabled == false then
			Left.Enabled = true
			Right.Enabled = true
		if key == "f" and Left.Enabled == true then
			Left.Enabled = false
			Right.Enabled = false
		end
		end
end)
end)

2 answers

May I ask what this script is in? Thank you. Please give me it's parents and the classname of (all) parent(s).

1 comment

0

This is not an answer. Use comments to clarify information.

Yeah this is an Car, here you go with Parents

Car -VehicleSeat --Lights -Body -Lights --FL ---FLL --FR ---FRL

(Srri Im a bit confused with this site, Im new here)

1 comment

0

This is not an answer. Please edit your original post if you would like to clarify information.

This discussion is preserved as it was. New answers, comments, and votes are closed.