Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

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

This discussion is preserved as it was. New answers, comments, and votes are closed.