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:

01script.Parent.Touched:connect(function(hit)
02    if hit.Parent:IsA("Model") then
03        local player = game.Players:GetPlayerFromCharacter(hit.Parent) -- Gets the player
04        if player.PlayerScripts.Quests:FindFirstChild("Quest_TheAwakening") then -- Is the quest there?
05            local quest = player.PlayerScripts.Quests:FindFirstChild("Quest_TheAwakening") -- Gets the quest
06            print(quest)
07            print(quest.Completed)
08            if quest.Completed ~= true then
09                quest.Objective.Value = quest.Objective.Value + 1
10            end
11        else
12            print("Could not find quest.")
13        end
14    end
15end)

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
01script.Parent.Touched:connect(function(hit)
02    if hit.Parent:IsA("Model") then
03        local player = game.Players:GetPlayerFromCharacter(hit.Parent) -- Gets the player
04        if player.PlayerScripts.Quests:FindFirstChild("Quest_TheAwakening") then -- Is the quest there?
05            local quest = player.PlayerScripts.Quests:FindFirstChild("Quest_TheAwakening") -- Gets the quest
06            print(quest)
07            print(quest.Completed)
08            if quest.Completed.Value ~= true then
09                quest.Objective.Value = quest.Objective.Value + 1
10            end
11        else
12            print("Could not find quest.")
13        end
14    end
15end)

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

1if quest.Completed
Ad

Answer this question