This is my first time scripting something like this, I'm not used to RemoteEvents or functions. I've tried everything to my knowledge and I just couldn't figure it out myself. Can someone tell me if I'm missing things, or doing something wrong, cause I know I am?
Original Local Script:
local mouse = game.Players.LocalPlayer:GetMouse() local Bus = game.Workspace:findFirstChild(game.Players.LocalPlayer.PlayerGui.TGUI.Value.Value) mouse.KeyDown:connect(function (key) key = string.lower(key) if key == "q" then -- LEFT SIGNAL Bus.Model.Bodykit.Blinkers.D40LFR1.LeftEnable.Value = not Bus.Model.Bodykit.Blinkers.D40LFR1.LeftEnable.Value Bus.Model.Bodykit.Blinkers.D40LFR1.RightEnable.Value = false Bus.Model.Bodykit.Blinkers.D40LFR1.HazardEnable.Value = false elseif key == "e" then -- RIGHT SIGNAL Bus.Model.Bodykit.Blinkers.D40LFR1.RightEnable.Value = not Bus.Model.Bodykit.Blinkers.D40LFR1.RightEnable.Value Bus.Model.Bodykit.Blinkers.D40LFR1.LeftEnable.Value = false Bus.Model.Bodykit.Blinkers.D40LFR1.HazardEnable.Value = false elseif key == "x" then -- HAZARDS Bus.Model.Bodykit.Blinkers.D40LFR1.HazardEnable.Value = not Bus.Model.Bodykit.Blinkers.D40LFR1.HazardEnable.Value Bus.Model.Bodykit.Blinkers.D40LFR1.LeftEnable.Value = false Bus.Model.Bodykit.Blinkers.D40LFR1.RightEnable.Value = false elseif key == "k" then -- KNEEL Bus.Model.Bodykit.Blinkers.D40LFR1.KneelEnable.Value = not Bus.Model.Bodykit.Blinkers.D40LFR1.KneelEnable.Value elseif key == "m" then -- FRONT DOOR OPEN/CLOSE Bus.Model.Bodykit.Blinkers.D40LFR1.FrontEnable.Value = not Bus.Model.Bodykit.Blinkers.D40LFR1.FrontEnable.Value elseif key == "n" then -- BACK DOOR OPEN/CLOSE Bus.Model.Bodykit.Blinkers.D40LFR1.RearEnable.Value = not Bus.Model.Bodykit.Blinkers.D40LFR1.RearEnable.Value elseif key == "l" then -- HEADLIGHTS Bus.Model.Bodykit.Blinkers.D40LFR1.HeadlightsEnable.Value = not Bus.Model.Bodykit.Blinkers.D40LFR1.HeadlightsEnable.Value elseif key == "j" then -- INTERIOR LIGHTS Bus.Model.Bodykit.Blinkers.D40LFR1.InteriorEnable.Value = not Bus.Model.Bodykit.Blinkers.D40LFR1.InteriorEnable.Value elseif key == "r" then -- REVERSE Bus.Model.Bodykit.Blinkers.D40LFR1.ReverseEnable.Value = not Bus.Model.Bodykit.Blinkers.D40LFR1.ReverseEnable.Value end end)
Modified Local script:
local key = game.Players.LocalPlayer:GetMouse() local event = game.ReplicatedStorage.BusEvent local Bus = game.Workspace:findFirstChild(game.Players.LocalPlayer.PlayerGui.TGUI.Value.Value) event:FireServer(key) end)
(RemoteEvent is in ReplcatedStorage named "BusEvent"
New Server script:
local event = game.ReplicatedStorage.BusEvent event.OnServerEvent:Connect(function (key) key = string.lower(key) if key == "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 == "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 == "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 == "k" then -- KNEEL Bus.Model.Bodykit.Blinkers.DriversCab.KneelEnable.Value = not Bus.Model.Bodykit.Blinkers.DriversCab.KneelEnable.Value elseif key == "m" then -- FRONT DOOR OPEN/CLOSE Bus.Model.Bodykit.Blinkers.DriversCab.FrontEnable.Value = not Bus.Model.Bodykit.Blinkers.DriversCab.FrontEnable.Value elseif key == "n" then -- BACK DOOR UNLOCK Bus.Model.Bodykit.Blinkers.DriversCab.RearEnable.Value = not Bus.Model.Bodykit.Blinkers.DriversCab.RearEnable.Value elseif key == "l" then -- HEADLIGHTS Bus.Model.Bodykit.Blinkers.DriversCab.HeadlightsEnable.Value = not Bus.Model.Bodykit.Blinkers.DriversCab.HeadlightsEnable.Value elseif key == "j" then -- INTERIOR LIGHTS Bus.Model.Bodykit.Blinkers.DriversCab.InteriorEnable.Value = not Bus.Model.Bodykit.Blinkers.DriversCab.InteriorEnable.Value elseif key == "r" then -- REVERSE Bus.Model.Bodykit.Blinkers.DriversCab.ReverseEnable.Value = not Bus.Model.Bodykit.Blinkers.DriversCab.ReverseEnable.Value end end)
This script will execute commands to other scripts within the model. This is the only local script I have an error with.