How do I make a script to where when a player sits on a Vehicle Seat GUI pops up on their screen? This is as far as I've gotten knowing what I know at the moment.
Workspace = script.Parent.Parent.Parent.Parent function OnTouched(Player) if game.Players:GetPlayerFromCharacter(Workspace) then end end script.Parent.Touched:connect(OnTouched)
I don't know if this is all correct. If you could, tell me what part(s) in scripting I should learn so next time when I want to do something like this I know exactly what to do. Thanks
P.s. I'm not asking you to make it for me, i'm asking what part(s) in scripting I should learn so next time when I want to do something like this I know exactly what to do.
Place this script and the GUI inside the vehicle seat.
seat = script.Parent s = script function onChildAdded(child) if child.Name == "SeatWeld" then local human = child.part1.Parent:findFirstChild("Humanoid") if (human ~= nil) then -- Replace GUI with the gui name s.GUI:clone().Parent = game.Players:findFirstChild(human.Parent.Name).PlayerGui end end end function onChildRemoved(child) if (child.Name == "SeatWeld") then local human = child.part1.Parent:findFirstChild("Humanoid") if (human ~= nil) then -- Replace GUI with the gui name game.Players:findFirstChild(human.Parent.Name).PlayerGui.GUI:remove() end end end script.Parent.ChildAdded:connect(onChildAdded) script.Parent.ChildRemoved:connect(onChildRemoved)