So, someone sits in a seat and the script prints the name in the output... It doesn't work, I'm making this so I can use it for a car later...
function OnSit() local Character = script.Parent.Occupant local Player = Character.Parent:GetPlayerFromCharacter() print(Player) end script.Parent.Changed:connect(OnSit)
Output says, when a player sits in a seat: "09:49:27.577 - GetPlayerFromCharacter is not a valid member of Model", And when a player gets out of the seat: "09:49:35.489 - Workspace.Model.Seat.Script:4: attempt to index local 'Character' (a nil value)"
function OnSit() local Character = script.Parent.Occupant local Player = Game.Players:GetPlayerFromCharacter(Character.Parent) --When using :GetPlayerFromCharacter(), the Character model goes inside the parenthesis. print(Player) end script.Parent.Changed:connect(OnSit)