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

How do I make blinkers on a car work in FE?

Asked by 6 years ago

I have tried converting the car to FE, but am stuck on the blinkers. Yes, I am using a RemoteEvent and I do know how FE works. All of the ways I have tried do not seem to work. When a user goes into and uses the car, the blinkers are controlled from a LocalScript which is placed in the users PlayerGui. The blinkers are consisted of spotlights as well as surface GUI's, they blinkers are placed into the workspace. Where would I place the remote event, to trigger the blinker, and where would I place the script that waits for the remote event to be fired? Here is the code in the localscript that would typically fire the remote event.

local player = game:GetService("Players").LocalPlayer

player:GetMouse().KeyDown:connect(function(key)
if key == "E" then
turn() --this fires a function which was used before, when the car was not FE and works fine still
--Here I would place the code to :FireServer() on the remoteevent
end
end)
--there is more to this script, this is only a portion

1 answer

Log in to vote
0
Answered by 6 years ago

This will be kind of hard to explain with the little context given but; place the RemoteEvent into the CARMODEL IN WORKSPACE. Your local script should look like:

local player = game:GetService("Players").LocalPlayer
local car = --You need to put a object connecting to the car here

player:GetMouse().KeyDown:connect(function(key)
    if key == "E" then
        -- Fire the event
        car.RemoteEvent:FireServer()
    end
end)

Now in the car there should be a server script with the following code:

local car = --You need to put a object connecting to the car here
local blinkers = false

-- Output of the event from client
car.RemoteEvent.OnServerEvent:connect(function(player)
    -- This toggles the blinkers
    blinkers = not blinkers

    if blinkers then
        -- Code to turn on blinkers
    else
        -- Code to turn them off
    end
end)

You say you've got a good knowledge of FE so I'm guessing that you know what most of these means. However this is some simple stuff so I would recommend checking out http://wiki.roblox.com/index.php?title=Remote_Events_and_Functions for extra help :)

0
Yes, I understand all of this, I will test it later. I will let you know if it works. CodedWealth 21 — 6y
0
Thanks, happy scripting:) DemotedGnar 95 — 6y
Ad

Answer this question