That script wouldn't do what you want all. The reason is because the Instance.GetChildren method returns an array and takes no arguments, so it won't look for a Humanoid inside of hit.Parent. It would just always execute because a table is a truthy value. We can accomplish this by using the Instance.FindFirstChild method.
script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
game.Lighting.ClockTime = 18
game.Lighting.OutdoorAmbient = Color3.fromRGB(127,127,127)
game.Lighting.ColorShift_Top = Color3.fromRGB(0,0,0)
end
end)
######Hopefully this answered your question and if it did, don't forget to hit that accept button. If you have any other questions then feel free to leave them down in the comments.
1 comment
holy cow 4 answers?!