Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Script cannot find the local player, any help?

zombie.Humanoid.Died:connect(function()
	local cv = zombie.Humanoid:FindFirstChild("creator")
	if cv then
		local k = cv.Value
		local player = game:GetService("Players"):FindFirstChild(k)
		print(k)
		if player then
			print("mhm")
		end
	end
end)

prink(k) is working, second print not

5 comments

0

What does the first print output? Is a player by that name in the game when it runs?

0

Yes, in print is my name and also in players

0

That's odd. Can you post a screenshot of the output and the playerlist at that point?

0

Sorry for the question, but where can I import it for you?

0

I sent it on discord

1 answer

✓ Accepted answer

We found out that cv is an ObjectValue, meaning that FindFirstChild() would always return nil (as it expects a string). The solution was to use this instead:

local player = cv.Value

This discussion is preserved as it was. New answers, comments, and votes are closed.