Hi, I'm here once again to ask how I can make a ui pop up when a player sits down in a chair. But if I do that then nothing happens. It doesn't even print in the output.
local gui = game.StarterGui.ScreenGui.Frame1 --the gui
local object = script.Parent --the seat
--Function Declaration
local function onPartTouched(otherPart)
-- Get the other part's parent
local partParent = otherPart.Parent
-- Look for a humanoid in the parent
local humanoid = partParent:FindFirstChildWhichIsA("Humanoid")
if humanoid then
-- print I am running for confirmation that the script is at least functioning then move the ui
print("Iamrunning")
object.AnchorPoint = Vector2.new(0.5, 0.5)
object.Position = UDim2.new(-0.5, -object.Size.X.Offset, 0.5, 0)
object:TweenPosition(UDim2.new(0.07, 0.4, 0.45, .5))
elseif nil then
object.Position = Vector2.new(.25, .60)
end
end
part.Touched:Connect(onPartTouched)--the function call
Can anyone say what I'm doing wrong. I don't think I quite understand how onPartTouched works.

2 comments
I would use Humanoid.Seated instead of onPartTouched
@FBS_8 I'm not sure how changing it to humanoid.seated would fix it. onPartTouched is merely a function declaration. Unless there's something I'm missing here