Here is my entire script:
01 | script.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 |
15 | 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...
01 | script.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 |
15 | end ) |
On line 14, You forgot to add .Value in front of
1 | if quest.Completed |