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

Completed is not a valid member of IntValue? Why am I getting this error?

Asked by 8 years ago
Edited 8 years ago

Here is my entire script:

script.Parent.Touched:connect(function(hit)
    if hit.Parent:IsA("Model") then
        local player = game.Players:GetPlayerFromCharacter(hit.Parent) -- Gets the player
        if player.PlayerScripts.Quests:FindFirstChild("Quest_TheAwakening") then -- Is the quest there?
            local quest = player.PlayerScripts.Quests:FindFirstChild("Quest_TheAwakening") -- Gets the quest
            print(quest)
            print(quest.Completed)
            if quest.Completed ~= true then
                quest.Objective.Value = quest.Objective.Value + 1
            end
        else 
            print("Could not find quest.")
        end
    end
end)

For some reason it prints quest.Completed, but when it gets to the if statement it says "Completed is not a valid member of IntValue".

Completed is a BoolValue with a StringValue as a parent, I'm not sure how IntValue got involved...

1 answer

Log in to vote
0
Answered by 8 years ago
script.Parent.Touched:connect(function(hit)
    if hit.Parent:IsA("Model") then
        local player = game.Players:GetPlayerFromCharacter(hit.Parent) -- Gets the player
        if player.PlayerScripts.Quests:FindFirstChild("Quest_TheAwakening") then -- Is the quest there?
            local quest = player.PlayerScripts.Quests:FindFirstChild("Quest_TheAwakening") -- Gets the quest
            print(quest)
            print(quest.Completed)
            if quest.Completed.Value ~= true then
                quest.Objective.Value = quest.Objective.Value + 1
            end
        else
            print("Could not find quest.")
        end
    end
end)

On line 14, You forgot to add .Value in front of

 if quest.Completed
Ad

Answer this question