Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

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 :)

2 comments

0

Yes, I understand all of this, I will test it later. I will let you know if it works.

0

Thanks, happy scripting:)

This discussion is preserved as it was. New answers, comments, and votes are closed.