Why is this script not changing the value inside the folder?

"QUEST02" is a Folder which is put into the player when the player starts a quest. I start the quest and then click the part to get +1 to the Value named "Number" inside "QUEST02"

The script is a LocalScript.

I have checked and all the variables should be correct.

So why is this script not working?

Any help is greatly appreciated!

function ChangeQuestValue()
	local Player = game.Players.LocalPlayer
	if Player ~= nil then
		if Player:FindFirstChild("QUEST02") ~= nil then
			local Quest = Player:FindFirstChild("QUEST02")
			if Quest:FindFirstChild("Number") ~= nil then
				local QuestValue = Quest:FindFirstChild("Number")
				QuestValue.Value = QuestValue.Value + 1
			end
		end
	end
end

script.Parent.ClickDetector.MouseClick:connect(ChangeQuestValue)

2 comments

0

Try adding print statments to each if block to see where it stops.

0

I did... and nothing is even printing... so I guess it is in calling the function, am I right?