Hi, so I am trying to make a simple lock script. When you sit in the car its sets a value, "Owner". The Owner value is an object value that points to the player/the cars owner. But when I add a script to the seat and do:

script.Parent.ChildAdded:connect(function()
-- Something
end)

I cant get the player because it's a script. And in this example, I need the player's name to be able to confirm that they are the owner of the car.

This is the script right now:

script.Parent.ChildAdded:connect(function(driver)
	if script.Parent.Owner.Value ~= nil then
		if driver.Name == script.Parent.Owner.Value then
			print("Access Granted.")
		else
			driver.Character.Humanoid.Jump = true
			print("Access Denied.")
		end
	end
	print("grgrthgtr")
end)

But there is an error saying "07:36:44.482 - Character is not a valid member of Weld".

Please help me.

1 comment

0

I am using A-Chassis btw.