Need help with a car gui

So, recently i’ve made a roblox car, and now I need help with making a gui PopUp and then by clicking this gui you can actually control the car, i tried using the remote event, but i don’t know that’s a good idea. Thanks for help! and sorry for my english.

4 Likes

Could we see the code so we will know what is wrong?

I don’t have a script there, I just need help how to make it PopUp, and sorry for being so late.

I’d say using a remote event would work, just use remoteevent:FireClient(player), and within a local script enable the gui with remoteevent.OnServerEvent:Connect(function() and gui.Enabled = true.

Alright, and how can I make that you can control the car by the gui? e.g. Clicking a gui will turn on headlights.

With the remote event the PopUp is working great, but i still have the issue with controlling the car.

Use a remote event again but fire it to the server instead when a button within the gui is pressed, then recieve the remote event in the server script which you can then use to activate the lights

What about a multiple number of cars? Maybe should I recieve the event in the car script?

Yea that would work, although there shouldn’t be any issues with multiple cars as long as you know which player is firing the events

How can i detect the player? Should I use the occupant function?

When you recieve the clientevent on the server, you can add a parameter, the first being the player

Ok, ill make the first version, Thank you so much!

1 Like

That’s not working, maybe I did something wrong?

game.ReplicatedStorage.CarEvents.OnServerEvent:Connect(function()
	for i,v in pairs(script.Parent.Lights) do
		v.Light.HeadLight.SpotLight.Enabled = true
		v.Light.HeadLight.Ray.Enabled = true
		v.Light.Color3 = Color3.new(0.996078, 1, 0.72549)
	end
end)

add :GetChildren() infront of script.Parent.Lights

It’s sadly still not working :confused:

v should now be relating to the light itself, so change the script stuff to v.Headlight instead of v.light, assuming that the children of Lights is Light

Im still doing something wrong:

local lights = script.Parent.Lights:GetChildren()
game.ReplicatedStorage.CarEvents.OnServerEvent:Connect(function()
	for i,v in pairs(lights) do
		wait(0.01)
		v.HeadLight.SpotLight.Enabled = true
		v.HeadLight.Ray.Enabled = true
		v.Light.Color3 = Color3.new(0.996078, 1, 0.72549)
	end
end)

Maybe it’s the local script or event problem?

script.Parent.MouseButton1Click:Connect(function()
	game.ReplicatedStorage.CarEvents.HeadlightsEvent:FireServer()
end)
-- This script is inside a car gui, and that event is inside a replicated storage

Nevermind, i found the issue, thank you for all your help!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.