How would i do this

local test = script.Parent
test.ClickDetector.MouseClick:Connect(function(hit)
	local player = hit.Player
	local testPart = player.Backpack:FindFirstChild("testPart")
	if testpart then
		print("TestCompleted")
	end
end)

I know that the error here is

local player = hit.player

The players backpack is in game.players but not workspace
I dont know how to change this to make it so it goes to game.Players with keeping the username.

1 Like

MouseClick automatically gives the player object as its argument so you can replace

test.ClickDetector.MouseClick:Connect(function(hit)

with

test.ClickDetector.MouseClick:Connect(function(player)

and remove the local player = hit.player line

1 Like

oh alright thanks! i totally forgot about that