Seat script for airline not working

I made a script for my airline for the seat do only if you are book in as first call you can sit tit the first class seats etc but i wot work i wonder why does anyone know? Here is my script i know its badly edited dont judge

local plr = ""



script.Parent.Touched:connect(function(hit)
	local plr = hit.Parent.Parent.Name
	local char = hit.Parent
		
	
	

	if  game.ReplicatedStorage.PodTech.Tickets:FindFirstChild(plr).Value == "First" then
		print("yes")
	else
		char.Humanoid.Jump = true
		
		end
	
end)

it also says this in the output

20:29:54.007 Workspace.Seat.MainScript (SETTINGS):12: attempt to index nil with ‘Value’ - Server - MainScript (SETTINGS):12

Your script isn’t formatted correctly… can you please reformat it

1 Like

How would i do this i cant figure it out?

image

1 Like

Now is it ok did i do it right?

Yeah! Thats perfect. charactersss

1 Like

Instead of local plr = hit.Parent.Parent.Name try getting the player by local plr = GetPlayerFromCharacter(hit.Parent)

1 Like

this still didnt fix my issue now it says

20:41:20.412 Workspace.Seat.MainScript (SETTINGS):6: attempt to call a nil value

Sorry, I fumbled at the beginning of the function, the correct thing is: game.Players:GetPlayerFromCharacter(hit.Parent)

1 Like

Pretty sure that’s referencing Workspace.

Change it to:

local plr = hit.Parent.Name
1 Like

Now it says
20:47:55.633 Workspace.Seat.MainScript (SETTINGS):12: attempt to index nil with ‘Value’
and
20:47:56.332 Argument 1 missing or nil
Is it a problem that the thing only appears basically when the class is booked

What do you mean “(plr).Value”, this was not supposed to be “(plr.Name).Value”?

And why at the beginning of the script does it have a variable local plr = "" since it already has the same variable inside the script?

how can i make it so if the value dosent exist it will also kick them out of the seat and like it updates when it changes value?