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

How to scirpt a gui inside a vehicle sit?

I like the car in TRC, with gears in the gui and horn, lights, flip button, boost (boost is only temporary). And the wheels of the car are moving left or right?

1 answer

That code will give the GUI of your choice to the player that sits in, and remove it when he jumps out.

local seat = -- Set that to your seat location
local gui = -- Set that to your GUI location 
local playergui

function Added(obj)
if (obj:IsA("Weld") and obj.Name == "SeatWeld") then
local plr = game.Players:GetPlayerFromCharacter(obj.Part1.Parent)
if (plr) then
playergui = gui:clone() 
playergui.Parent = plr.PlayerGui
end
end
end

function Removed(obj)
if (obj:IsA("Weld") and obj.Name == "SeatWeld") then
local plr = game.Players:GetPlayerFromCharacter(obj.Part1.Parent)
if (plr) and playergui then
playergui:Destroy()
end
end
end

seat.ChildAdded:connect(Added)
seat.ChildRemoved:connect(Removed)

Then you can add anything that you'd like in your GUI.

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