Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

My script won't detect the Humanoid.SeatPart?

Asked by
zomspi 541 Moderation Voter
4 years ago
Edited 4 years ago

I saw the SeatPart property of the Humanoid as I needed it for my game, I'd never used it before so I experimented but it doesn't work. My local script won't print (warn) 2.

script.Parent.MouseButton1Click:Connect(function()
    local plr = game.Players.LocalPlayer
    local char = plr.Character
    if char.Humanoid.Sit == true then
        warn("1")
        if char.Humanoid.SeatPart == game.Workspace.Plots.University.Chair.University then
            warn("2")
            local study = script.Parent.Parent.Study.Text
            while char.Humanoid.SeatPart == "University" do
                wait(5)
                warn("3")
                game.ReplicatedStorage.Studies:FireServer(study)

            end
    end

    end
end)

1
The Humaniod.SeatPart return the SeatPart itself not the Name of the SeatPart. So you should do SeatPart.Name https://developer.roblox.com/en-us/api-reference/property/Humanoid/SeatPart Block_manvn 395 — 4y
0
Zomspi make sure you do more research than asking. JesseSong 3916 — 4y
0
@JesseSong I will next time, but I looked on our profile and you have 3 questions that are: "Are serverscriptservice and serverstorage the same thing" - Easily re-searchable "Can someone give me a full list of all the services" - Easily re-searchable "Can someone define the script Touched:Wait() for me" - Easily re-searchable -=- I am sorry but please don't complain when you do the same zomspi 541 — 4y

1 answer

Log in to vote
1
Answered by 4 years ago
Edited 4 years ago

Hello! This might help you:

if char.Humanoid.SeatPart.Name -- I added a Name, as that object has a Name.

Hope It helps :). EDIT: There is one more part you have to switch up, right here:

while char.Humanoid.SeatPart.Name == "University" -- I changed this to name. 
Ad

Answer this question