I'm very new to scripting with this kind of stuff, and I don't know what else to do for this event.
Basically, I have a Local Script which connects to a Server script. I want the Server script to execute commands to other scripts in the bus, but I ran the Script Debug errors and one error came up as "attempt to index local 'Bus' (a nil value)"
Here's the scripts:
Local script:
local uiService = game:GetService("UserInputService")
local event = game.ReplicatedStorage.BusEvent
local mouse = game.Players.LocalPlayer:GetMouse()
local Bus = game.Workspace:FindFirstChild(game.Players.LocalPlayer.PlayerGui.TGUI.Value)
uiService.InputBegan:Connect(function(key)
event:FireServer(key.KeyCode)
end)
Server script:
local event = game.ReplicatedStorage.BusEvent
event.OnServerEvent:Connect(function(player, key)
local Bus = workspace:FindFirstChild(player.PlayerGui.TGUI.Value)
if key == Enum.KeyCode.Q then -- LEFT SIGNAL
Bus.Model.Bodykit.Blinkers.DriversCab.LeftEnable.Value = not Bus.Model.Bodykit.Blinkers.DriversCab.LeftEnable.Value
Bus.Model.Bodykit.Blinkers.DriversCab.RightEnable.Value = false
Bus.Model.Bodykit.Blinkers.DriversCab.HazardEnable.Value = false
elseif key == Enum.KeyCode.E then -- RIGHT SIGNAL
Bus.Model.Bodykit.Blinkers.DriversCab.RightEnable.Value = not Bus.Model.Bodykit.Blinkers.DriversCab.RightEnable.Value
Bus.Model.Bodykit.Blinkers.DriversCab.LeftEnable.Value = false
Bus.Model.Bodykit.Blinkers.DriversCab.HazardEnable.Value = false
elseif key == Enum.KeyCode.X then -- HAZARDS
Bus.Model.Bodykit.Blinkers.DriversCab.HazardEnable.Value = not Bus.Model.Bodykit.Blinkers.DriversCab.HazardEnable.Value
Bus.Model.Bodykit.Blinkers.DriversCab.LeftEnable.Value = false
Bus.Model.Bodykit.Blinkers.DriversCab.RightEnable.Value = false
elseif key == Enum.KeyCode.K then -- KNEEL
Bus.Model.Bodykit.Blinkers.DriversCab.KneelEnable.Value = not Bus.Model.Bodykit.Blinkers.DriversCab.KneelEnable.Value
elseif key == Enum.KeyCode.M then -- FRONT DOOR OPEN/CLOSE
Bus.Model.Bodykit.Blinkers.DriversCab.FrontEnable.Value = not Bus.Model.Bodykit.Blinkers.DriversCab.FrontEnable.Value
elseif key == Enum.KeyCode.N then -- BACK DOOR UNLOCK
Bus.Model.Bodykit.Blinkers.DriversCab.RearEnable.Value = not Bus.Model.Bodykit.Blinkers.DriversCab.RearEnable.Value
elseif key == Enum.KeyCode.L then -- HEADLIGHTS
Bus.Model.Bodykit.Blinkers.DriversCab.HeadlightsEnable.Value = not Bus.Model.Bodykit.Blinkers.DriversCab.HeadlightsEnable.Value
elseif key == Enum.KeyCode.J then -- INTERIOR LIGHTS
Bus.Model.Bodykit.Blinkers.DriversCab.InteriorEnable.Value = not Bus.Model.Bodykit.Blinkers.DriversCab.InteriorEnable.Value
elseif key == Enum.KeyCode.R then -- REVERSE
Bus.Model.Bodykit.Blinkers.DriversCab.ReverseEnable.Value = not Bus.Model.Bodykit.Blinkers.DriversCab.ReverseEnable.Value
end
end)
If anyone can please help me out that would be amazing!

6 comments
Should I use WaitForChild on the Local, Server, or both scripts on Bus?
Both. You generally want to use it if its a necessary reference being made at the top of your script.
So I've used it for both, then I got another error saying it's an infinite yield. What should I do>
That's because your input to the WaitForChild command cannot be found. Most likely it's nil. You should make sure that game.Players.LocalPlayer.PlayerGui.TGUI.Value has a valid value, and don't index it using player.PlayerGui.TGUI. etc..., instead use more variables and WaitForChild's to make sure that each element exists.
I edited the post to show you what I mean.
I've tried both your methods, none of them seem to resolve the issue. I'm willing to show you parts of the vehicle so we can probably better identify the problem. My Discord is @mikenoza#5455 please reach me there.