How to disable Backpack/Toolbar when seated?

I am in the proccess of making a car and I am trying to make it so when a player is seated it disables their toolbar, how can I do this?

My attempt (Doesn’t work):

local seat = script.Parent.Parent
local starterGui = game.StarterGui


seat:GetPropertyChangedSignal("Occupant"):Connect(function(player) 

	if seat.Occupant then
		
		starterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)
		
	else
		
		starterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, true)

	end
end)

Is this in a local script or normal script?

Local as this will only happen for the seated. I’m gonna see if moving the LocalScript to StarterGui will work as that’s worked with these CoreUI scripts.

Edit: It worked, sorry for wasting your time @Nyonic.

3 Likes