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

How to scirpt a gui inside a vehicle sit?

Asked by 10 years ago

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

Log in to vote
1
Answered by
Spectrobz 140
10 years ago

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.

Ad

Answer this question