Attempt to index nill with "Name"

Hi, I’m trying to make a system, where when a player stays at a cash register for a specific amount of time, and then unclaims the register automatically.

I’m getting the error, that player is “nill”.

I’ve looked up so many solutions none of them seemed to work.

Main Code:

local Claimed = script.Parent.Claimed
local LoggedPlayer = script.Parent.LoggedPlayer
local PassingTime = script.Parent.PassingTime
local Events = game.ReplicatedStorage.Registers

	if Claimed.Value == true and player.Name == LoggedPlayer.Value and player.PlayerHasClaimedRegister.Value == true and PassingTime.Value == script.Parent.MaxTime.Value then
		Claimed.Value = false
		script.Parent.MaxTime.Value = 1200
		PassingTime.Value = 0
		script.Parent.Display.TimePassed.Text = 0
		player.PlayerHasClaimedRegister.Value = false
		script.Parent.Display.UIGradient.Color =, 1, 0.713725),, 1, 1))
		LoggedPlayer.Value = ""    
		script.Parent.Display.TextLabel.Text = "Unclaimed Register (Click to Claim)"

Any help would be gladly appreciated.

are you using a remote event or a blindable event?

Can you maybe send the script where you :Fire() the event?

I’m using a blindable event, since I’m doing it from a server script.

Okay, here:

local Claimed = script.Parent.Claimed
local PassingTime = script.Parent.PassingTime
local Events = game.ReplicatedStorage.Registers

		if script.Parent.MaxTime.Value == PassingTime.Value then

This is part of the main script, but it’s where it fires the event.

You have forgot to pass in the player instance


Oh, okay. Let me try that. Thanks!

Thanks so much! It worked just fine! :heart:

You’re welcome my dude! I’m happy if I can help.

1 Like