Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why wont this work?

Asked by 10 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

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

Log in to vote
-1
Answered by 10 years ago

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

0
This is not an answer. Use comments to clarify information. User#11893 186 — 10y
Ad
Log in to vote
-1
Answered by 10 years ago

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)

0
This is not an answer. Please edit your original post if you would like to clarify information. User#11893 186 — 10y

Answer this question