If you have a X name tool you can seat else no

Hello, I would like to get support in the following thing:
I need to do like if you have a tool called for example car key you can seat if you don’t have that tool you will not be able to seat.

I’ve tried searching in the devforum, YouTube and even in google but I don’t find any tutorial and I think any scripted could help me as I think it’s not a very complex thing.

If any of would be able to help me I would be more than pleased!

here’s how you can do it

local YourToolName = "CarKey"
script.Parent:GetPropertyChangedSignal("Occupant"):Connect(function()
if script.Parent.Occupant == nil then return end
local Humanoid = script.Parent.Occupant
local Character = Humanoid.Parent
local Player = game.Players:GetPlayerFromCharacter(Character)
if Humanoid then
local Tool = Character:FindFirstChild(YourToolName) or Player.Backpack:FindFirstChild(YourToolName)
if not Tool then Humanoid.Sit = false return end
end
end)


Well I added the script in the seat and don’t work I did something wrong?

did you replace “YourToolName” to your tool name?
if so is there any errors in the output?

image
That what appear

Nope I did not replace yourToolName with anything.

i fixed the code try again.
you have to replace YourToolName to your ToolName.


no you have to replace just the string change CarKey back to YourToolName.

like this right?
image

1 Like

change this line

if not Tool then Humanoid.Sit = false return end

to

if not Tool then script.Parent.SeatWeld:Destroy() return end
1 Like

add a wait before it
like wait(0.1)

if not Tool then wait(0.1) script.Parent.SeatWeld:Destroy() return end
1 Like

Thank you sooooo much really. :slight_smile:
You helped me a lot!

1 Like

Hey can I was ading a UI to the seat and I scripted it (from your script) and I dont know why dont work lemme show you a picture

I added to the script this and im not sure why dont works

image

and when I test it the seat works but the UI does not enable keeps the same.
And one more time thx for helping me

its because you’re changing the gui in the StarterGui
you have to to put the variable Noti After the Player Variable

local Noti = Player.PlayerGui.Noti
1 Like



Suppostly is good why doesnt work?

add a WaitForChild()

local Noti = Player.PlayerGui:WaitForChild("Noti")

if it didnt work most likely Noti isn’t in StarterGui then

1 Like

image

its called NotificationUI not Noti
local Noti = Player.PlayerGui.NotificationUI

1 Like