The error I have:
15:48:41.918 - Workspace.KINGCHAIR.Seat.Script:1: attempt to index nil with 'Parent' 15:48:41.919 - Stack Begin 15:48:41.919 - Script 'Workspace.KINGCHAIR.Seat.Script', Line 1
The code I used:
local char = script.Parent.Occupant.Parent
repeat wait() until char
local plr = game.Players:GetPlayerFromCharacter(char)
if plr.TeamColor ~= BrickColor.new("Deep orange") then
char.Character.Humanoid.Health = 0
end
My goal is to create a chair when someone that is not in the team of King or has the team color of deep orange, they die unless they are in the team of King or do have the team color of deep orange.
Does anyone know how to fix this scripting problem? Thank you for reading.