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

Why isn't :GetPlayerFromCharacter() working?

Asked by 9 years ago

This is my leaderboard script:

function playerJoined(player)
    local inGame = Instance.new('BoolValue')
    inGame.Name = 'isPlayerIngame'
    inGame.Parent = player
    inGame.Value = false
end
game.Players.PlayerAdded:connect(playerJoined)

This is another script that keeps breaking:

function onTouch(hit)
    local hum = hit.Parent
    if hit ~= nil then
        if hum ~= nil then
            local plr = game.Players:GetPlayerFromCharacter(hum)
            plr.leaderstats.isPlayerIngame.Value = true
        end
    end
end
script.Parent.Touched:connect(onTouch)

Error: 11:48:04.886 - isPlayerIngame is not a valid member of IntValue 11:48:04.888 - Script 'Workspace.valuegiver.Script', Line 6 11:48:04.889 - Stack End

1 answer

Log in to vote
0
Answered by 9 years ago

Nevermind. I got the hierarchy wrong.

Ad

Answer this question