#Keybind not registering

38 messages · Page 1 of 1 (latest)

vocal finch
#

UserInputService.InputBegan:Connect(function(input, gameProcessed)
if input.KeyCode == indicator.Controls.LeftIndicator then
print("WORKING")
end
if bool and bool.Value ~= nil then
BL.Enabled = true
BL.Enabled = true
end
end)

ignore the bool part, but when I press "LeftBracket" which "indicator.Controls.LeftIndicator" is linked to inside the module script, why is it when I do press "LeftBracket", nothing happens

bleak craterBOT
#

studio** You are now Level 5! **studio

zinc silo
vocal finch
#

ill send the script here

zinc silo
#

make it local script

vocal finch
#

oh

zinc silo
#

UIS only works on client

vocal finch
#

it still doesnt seem to work

#

lemme send the code

zinc silo
#

errors?

vocal finch
#

local indicators = {}

-- Keybinds
indicators.Controls = {
RightIndicator = Enum.KeyCode.RightBracket,
LeftIndicator = Enum.KeyCode.LeftBracket,
}

return indicators

this is the module script

#

-- Input Service
local UserInputService = game:GetService("UserInputService")
-- Indicator Module Script
local indicator = require(game.ReplicatedStorage.Indicator)
print("Module Began")
-- Player
local Player = game:GetService("Players")
Player.PlayerAdded:Connect(function(player)
local playername = player.Name
local humanoid = if player.Character then player.Character:FindFirstChild("Humanoid") else nil
end)
print("Players Spawned")
-- Drive Seat
local driver = script.Parent
print("Driver Seats Work")
-- Left + Right Indicator Groups
local left = script.Parent.Parent.Body.Indicators.Left
local right = script.Parent.Parent.Body.Indicators.Right
print("Group Models Work")
-- Left + Right Models
local BL = left["Back Left"].SpotLight
local BR = right["Back Right"].SpotLight
local FL = left["Front Left"].SpotLight
local FR = right["Front Right"].SpotLight
print("Blocks Spawned")
-- Bool Value
local bool = script.Parent.Parent.Body.Indicators.BoolValue
-- Main Script
if bool then
bool.Value = false
end
driver:GetPropertyChangedSignal("Occupant"):Connect(function()
bool.Value = driver.Occupant ~= nil
end)
print("Bool Value Initialised")

UserInputService.InputBegan:Connect(function(input, gameProcessed)
if input.KeyCode == indicator.Controls.LeftIndicator then
print("WORKING")
end
if bool and bool.Value ~= nil then
BL.Enabled = true
BL.Enabled = true
end
end)

this is the now local script

vocal finch
vocal finch
zinc silo
#
-- Services
local UserInputService = game:GetService("UserInputService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
-- Indicator Module Script
local indicator = require(ReplicatedStorage.Indicator)

-- Player
local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()

-- Drive Seat
local driver = script.Parent
local body = driver.Parent.Body
-- Left + Right Indicator Groups
local left = body.Indicators.Left
local right = body.Indicators.Right
-- Left + Right Models
local BL = left["Back Left"].SpotLight
local BR = right["Back Right"].SpotLight
local FL = left["Front Left"].SpotLight
local FR = right["Front Right"].SpotLight
-- Bool Value
local bool = body.Indicators:FindFirstChild("BoolValue")
-- Main Script
if bool  then
    bool.Value = false
end

driver:GetPropertyChangedSignal("Occupant"):Connect(function()
    bool.Value = driver.Occupant ~= nil
end)

UserInputService.InputBegan:Connect(function(input, gameProcessed)
    if input.KeyCode == indicator.Controls.LeftIndicator and not gameProcessed then
        print("WORKING")
    end
    
    if bool and bool.Value ~= nil then
        BL.Enabled = true
        FL.Enabled = true
    end
end)
```try this
zinc silo
#

any errors?

vocal finch
#

nope

#

what im trying to do is when someone sits on the chassis they can control the indicator

#

so the local script is under the drive seat which is fine right?

zinc silo
#

and its in workspace?

vocal finch
#

yeah

#

i circled the script

zinc silo
#

local script doesnt work in workspace

#

local script works only in
StarterGui
StarterPack
StarterPlayerScripts
StarterCharacterScripts
ReplicatedFirst

vocal finch
#

ohhhh okay so which one do i move it into

zinc silo
#

also backpack, playergui, playerscripts

zinc silo
#

and change ur variables

bleak craterBOT
#

studio** You are now Level 16! **studio

vocal finch
#

thanks you so much man 🙂

#

really appreciated

#

works now

zinc silo
#

👍

vocal finch
# zinc silo 👍

sorry to bother you again but is there a way that I can make it so that you can only click it when you are sitting on the driveseat?