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

Why wont this script work Im trying to make it check when the player is sitting on the chair?

Asked by 3 years ago

Its not working

local clipboardChildren = game.Workspace.ClipBoard:GetChildren()

script.Parent.Touched:Connect(function(hit)
    if hit.Parent:FindFirstChild("Humanoid")then
        local human = hit.Parent:FindFirstChild("Humanoid")
        if human.Sit == true then 
        print("Human Sitting")
            for i,object in pairs(clipboardChildren) do
                object.Transparency = 0
            end
        else
            print("Human Not Sitting")
            for i,object in pairs(clipboardChildren) do
                object.Transparency = 1
            end
        end
    end
end)

1 answer

Log in to vote
1
Answered by
4jnx 50
3 years ago
Edited 3 years ago

Hello there! I put together this code that should work for detecting players sitting in seats

local Players = game:GetService("Player")

local Player = Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()

Character:WaitForChild("Humanoid").Seated:Connect(function(IsSeated, Seat)
    if not IsSeated or Seat.Name ~= "seat name" then 
          --Code here
    end
end)

Hope this helped!

0
Thanks robot7866 36 — 3y
0
How do I check if the player got up then? robot7866 36 — 3y
0
why did you change the script, instead of helping him with the question? JesseSong 3916 — 3y
0
you also didn't even explain it JesseSong 3916 — 3y
Ad

Answer this question