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

Why do I keep getting this error?

Asked by 10 years ago

I've been working on a little project that is about basketball and I am trying to add points to a value depending on what the players pointposition is. The pointposition value is an intvalue that is cloned whenever the character is added. the intvalue is put into the player then and the value is 3. I am trying to add the value of the point position to another value which is repeated as an auto-updater to send to the leaderboard which will update on everybody's screens. Here is the main script that tries adding the points.

script.Parent.Touched:connect(function(player)
        local getvalue = player.Parent.lastowner
        game.Workspace:FindFirstChild(getvalue.Value)
            local thisval = getvalue:findFirstChild("PointPosition")

            if thisval.Value == 3 then
                game.Workspace.TeamScores.BlueTeam.Value = game.Workspace.TeamScores.BlueTeam.Value + 3
            elseif thisval.Value == 2 then
                game.Workspace.TeamScores.BlueTeam.Value = game.Workspace.TeamScores.BlueTeam.Value + 2
    end
end)

and then here is the pointposition value adder

game.Players.PlayerAdded:connect(function(player)
    player.CharacterAdded:connect(function(char)
        local pposition = game.Workspace.PointPosition:clone()
        pposition.Parent = char
        pposition.Name = "PointPosition"
        pposition.Value = 3
    end)
end)

and last but not least here is a censor script for the 3 pt'ers

script.Parent.Touched:connect(function(player)
    if player.Parent.ClassName == "Model" and player.Parent:FindFirstChild("Humanoid") then
        player.Parent.PointPosition.Value = "3"
    end
end)

Please if you can help me figure this out that would be great!

Answer this question