I am making a tycoon, when you touch the gate, the gate puts your name in a string value. this code used to work but errored when i tried to find a player , i changed the code at the bottom, now the top doesn't work

mparent = script.Parent.Parent.Parent
Gamer = mparent.Player
print(Gamer.Value)
db = false
cost = 189
function onTouch(hit)
	print("hited")
	print(hit.Parent)
	print(Gamer.Value)

no errors, only says this in output: hited Player1 nil