Super cringey question.. How would I get the player from a seat from the ChildAdded function? I tried everything I know and I also researched it but I couldn't find anything.
I also tried using the 'Touched' function for this to get the player (onTouch.Parent) with a debounce etc but that's really not efficient and glitchy. Help would be appreciated!
You can use the ChildAdded
and ChildRemoved
events as so.
I won't go much into explanation, but this is a method you can use:
local plr = nil; script.Parent.ChildAdded:connect(function(pl) if not pl:IsA("Weld") then return end if plr ~= nil then return end local torso = pl.Part1 local char = torso.Parent plr = game.Players:GetPlayerFromCharacter(char) if plr == nil then return end print("Person Sitting: " .. plr.Name) end) script.Parent.ChildRemoved:connect(function (pl) if not pl:IsA("Weld") then return end if plr == nil then return end print("Got Off!") plr = nil end)
I learnt this method from 'dr01d3k4's post on it a year or so back.