I am trying to make a BoolValue change when a player sits on a seat but nothings happening and
the Output tab isn’t showing any errors so I think I might be missing something
Script:
script.Parent.Touched:connect(function(hit)
script.Parent.ChildAdded:connect(function(child)
if child.Name=="SeatWeld" then
script.Parent.DustOff = true
end
end)
end)
end
NOTE: I have fixed the .Value in line 4 but the script still wont change the value
function checkOccupant()
if seat.Occupant ~= nil then --checks if there is someone in the seat
local findPlayer = game.Players:FindFirstChild(seat.Occupant.Parent.Name) --finds player from the character's Name
if findPlayer then
print("player has sat down")
script.Parent.DustOff.Value = true
end
else
script.Parent.DustOff.Value = false
end
end
seat.Changed:Connect(function()
checkOccupant() --fires whenever someone sits down or leaves the seat
end)
local seat = script.Parent
function checkOccupant()
script("Check_1")
if seat.Occupant ~= nil then --checks if there is someone in the seat
local findPlayer = game.Players:FindFirstChild(seat.Occupant.Parent.Name) --finds player from the character's Name
if findPlayer then
print("player has sat down")
script.Parent.DustOff.Value = true
end
else
script.Parent.DustOff.Value = false
end
end
seat.Changed:Connect(function()
checkOccupant() --fires whenever someone sits down or leaves the seat
end)