I’ve been trying to create a script under a VehicleSeat that unequips a tool right after sitting. I’m using a custom toolbar and I have already made a script that doesn’t allow you to equip tools after you have entered the seat but the problem is when you enter the seat with a tool already equipped, it keeps it equipped while in the seat.
I’ve tried to use humanoid:UnequipTools() but I haven’t been able to make the correct code
local Players = game:GetService("Players")
local Seat = script.Parent
Seat:GetPropertyChangedSignal("Occupant"):Connect(function()
local humanoid = Seat.Occupant
if not humanoid then return end
humanoid:UnequipTools()
end)
As you have tried, you would use humanoid:UnequipTools() and detect if the humanoid is added to the seat.
local seat = --seat
seat.ChildAdded:Connect(function(child)
if child.Name == "SeatWeld" then
local hum = child.part1.Parent:FindFirstChild("Humanoid")
if hum then
hum:UnequipTools()
end
end
end)