How do I enable a GUI to 1 player on the vehicle seat when two parts touch each other?

heloo!! i want a GUI to appear to the player in the vehicle seat (indicated in the green circle) when both parts in the blue circle touch each other
studio issue

so far i’ve only tried using remote events to enable the GUI for the player

Server Script:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local SignalA = script.Parent.Parent.SignalALights
local SignalB = script.Parent.Parent.SignalBLights

script.Parent.Touched:Connect(function(hit)
	if hit.Name == "Trig" then
		if SignalA.Red.Color == Color3.fromRGB(229, 71, 23) then
			hit.Speed.Value.MaxSpeed.Value = "0"
			task.wait(10)
			hit.Speed.Value.MaxSpeed.Value = "20"
			ReplicatedStorage.SPSBot:FireClient("20 SPS")
		elseif SignalA.Red.Color == Color3.fromRGB(59, 17, 6) then
			hit.Speed.Value.MaxSpeed.Value = "20"
			ReplicatedStorage.SPSBot:FireClient("20 SPS")
		end
	end
end)

Local Script:

local ReplicatedStorage = game:GetService("ReplicatedStorage")

ReplicatedStorage.SPSBot.OnClientEvent:Connect(function(Player, Request)
	if Request == "20 SPS" then
		script.Parent["20_SPS"]:TweenPosition(UDim2.new(0, 0, 0, 0), "InOut", "Quad", 1.25, true)
		task.wait(5)
		script.Parent["20_SPS"]:TweenPosition(UDim2.new(0, 0, -0.3, 0), "InOut", "Quad", 1.5, true)
	end
end)

If these are of any help:
The server script is inside the bottom center part of the image above
Screenshot 2024-08-30 181403

Local script’s located in a folder in StarterGui
Screenshot 2024-08-30 181335

1 Like

You are supposed to send the player argument from the server instead of the client. Then on the client you receive that string you sent.Smth like this:

ReplicatedStorage.SPSBot:FireClient(player, “20 SPS”)

Now to get the player on the server, simply do this

local hum = workspace.Train.DriverSeat.Occupant — Change this to your vehicle seat 
local player = game.Players:GetPlayerFromCharacter(hum.Parent)

do i put this in the local script or server script?

I stated in the post, in server script (don’t paste it in like that, make proper changes first)

2 Likes

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