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

Im making throttle notches where the ImageLabel changed using keys. Can anyone help me?

Asked by 1 year ago

The problem im currently facing right now is that when I clicked the exact key, the gui color doesn't change as it needed. Here's the script:

local UserInputService = game:GetService("UserInputService")
local seat = script.Parent.Parent.Parent.Parent
local Players = game:GetService("Players")
local Notch1 = script.Parent["Notch+1"].ImageColor3
local Notch2 = script.Parent["Notch+2"].ImageColor3
local Notch3 = script.Parent["Notch+3"].ImageColor3
local Notchneutral = script.Parent.NotchNeutral.ImageColor3
local NotchN1 = script.Parent["Notch-1"].ImageColor3
local NotchN2 = script.Parent["Notch-2"].ImageColor3
local NotchN3 = script.Parent["Notch-3"].ImageColor3

Notchneutral = Color3.fromRGB(85, 170, 0)

UserInputService.InputBegan:connect(function(input)
    if input.KeyCode == Enum.KeyCode.W then -- Notch Neutral to Notch+1
        if Notchneutral == Color3.fromRGB(85, 170, 0) then
            Notch1 = Color3.fromRGB(85, 170, 0)
            Notchneutral = Color3.fromRGB(0, 0, 0)
        end
    end
    if input.KeyCode == Enum.KeyCode.W then -- Notch+1 to Notch+2
        if Notch1 == Color3.fromRGB(85, 170, 0) then
            Notch2 = Color3.fromRGB(85, 170, 0)
            Notch1 = Color3.fromRGB(0, 0, 0)
        end
    end
    if input.KeyCode == Enum.KeyCode.W then -- Notch+2 to Notch+3
        if Notch2 == Color3.fromRGB(85, 170, 0) then
            Notch3 = Color3.fromRGB(85, 170, 0)
            Notch2 = Color3.fromRGB(0, 0, 0)
        end
    end
    if input.KeyCode == Enum.KeyCode.S then -- Notch+3 to Notch+2
        if Notch3 == Color3.fromRGB(85, 170, 0) then
            Notch2 = Color3.fromRGB(85, 170, 0)
            Notch3 = Color3.fromRGB(0, 0, 0)
        end
    end
    if input.KeyCode == Enum.KeyCode.S then -- Notch+2 to Notch+1
        if Notch2 == Color3.fromRGB(85, 170, 0) then
            Notch1 = Color3.fromRGB(85, 170, 0)
            Notch2 = Color3.fromRGB(0, 0, 0)
        end
    end
    if input.KeyCode == Enum.KeyCode.S then -- Notch+1 to Notch Neutral
        if Notch1 == Color3.fromRGB(85, 170, 0) then
            Notchneutral = Color3.fromRGB(85, 170, 0)
            Notch1 = Color3.fromRGB(0, 0, 0)
        else
            Notchneutral = Color3.fromRGB(85, 170, 0)
        end
    end
    --Brakes
    if input.KeyCode == Enum.KeyCode.A then -- Notch Neutral to Notch-1
        if Notchneutral == Color3.fromRGB(85, 170, 0) then
            NotchN1 = Color3.fromRGB(85, 170, 0)
            Notchneutral = Color3.fromRGB(0, 0, 0)
        end
    end
    if input.KeyCode == Enum.KeyCode.A then -- Notch-1 to Notch-2
        if NotchN1 == Color3.fromRGB(85, 170, 0) then
            NotchN1 = Color3.fromRGB(85, 170, 0)
            NotchN2 = Color3.fromRGB(0, 0, 0)
        end
    end
    if input.KeyCode == Enum.KeyCode.A then -- Notch-2 to Notch-3
        if NotchN2 == Color3.fromRGB(85, 170, 0) then
            NotchN2 = Color3.fromRGB(85, 170, 0)
            NotchN3 = Color3.fromRGB(0, 0, 0)
        end
    end
    if input.KeyCode == Enum.KeyCode.D then -- Notch-3 to Notch-2
        if NotchN3 == Color3.fromRGB(85, 170, 0) then
            NotchN3 = Color3.fromRGB(85, 170, 0)
            NotchN2 = Color3.fromRGB(0, 0, 0)
        end
    end
    if input.KeyCode == Enum.KeyCode.D then -- Notch-2 to Notch-1
        if NotchN2 == Color3.fromRGB(85, 170, 0) then
            NotchN2 = Color3.fromRGB(85, 170, 0)
            NotchN1 = Color3.fromRGB(0, 0, 0)
        end
    end
    if input.KeyCode == Enum.KeyCode.D then -- Notch-1 to Notch Neutral
        if NotchN1 == Color3.fromRGB(85, 170, 0) then
            Notchneutral = Color3.fromRGB(85, 170, 0)
            NotchN1 = Color3.fromRGB(0, 0, 0)
        else
            Notchneutral = Color3.fromRGB(85, 170, 0)
        end
    end
end)
0
No clue how it's supposed to change from the description, any more context? blowup999 659 — 1y

Answer this question