Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Script cannot find the local player, any help?

Asked by
InLeXiX 18
4 years ago
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

0
What does the first print output? Is a player by that name in the game when it runs? gskw 1046 — 4y
0
Yes, in print is my name and also in players InLeXiX 18 — 4y
0
That's odd. Can you post a screenshot of the output and the playerlist at that point? gskw 1046 — 4y
0
Sorry for the question, but where can I import it for you? InLeXiX 18 — 4y
0
I sent it on discord InLeXiX 18 — 4y

1 answer

Log in to vote
0
Answered by
gskw 1046 Moderation Voter
4 years ago

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
Ad

Answer this question