I am making a quest system and to fix a bug where it triggers the GUI I wanted to get a boovalue set on the player so that the gui only updates the questprogress value when the boolvalue is true.
I am using the video ZarksDev made but am expanding on it a bit to test boolvalues but ran into this issue.
Here is part of the code from his video I added and ‘questAcceptedState’ always prints false, I tried added a remote event but maybe I don’t understand bools very well.
local questAcceptedState = Instance.new("BoolValue", quest)
questAcceptedState.Name = "QuestAcceptedState"
questAcceptedState = false
Remotes:WaitForChild("Quest"):WaitForChild("QuestAcceptedState").OnServerEvent:Connect(function(player, questAcceptedState)
print("server fired should change")
player.Quest.QuestAcceptedState.Value = true
end)
questProgress:GetPropertyChangedSignal("Value"):Connect(function()
print(questAcceptedState)
if questAcceptedState and questAcceptedState == true then
if questTask.Value ~= nil then
if questProgress.Value >= questGoal.Value then
player:WaitForChild("PlayerGui"):WaitForChild("QuestUIButton"):WaitForChild("Frame").Visible = false
player:WaitForChild(questRewardCurrencyFolder.Value):WaitForChild(questRewardCurrency.Value).Value += questReward.Value
for i, v in pairs(quest:GetChildren()) do
if v:IsA("StringValue") then
v.Value = ""
elseif v:IsA("NumberValue") or v:IsA("IntValue") then
v.Value = 0
end
end
questAcceptedState = false
end
end
end
This is the main problem with the code as it will never allow the quest to finish because it is always false. I also need this so I can add other values for different checks, like what quest they are on.
Yes it prints the remote event, and it still prints false when the next function is called.
My guess is something with the server I have tried reading about it but… just not any conoclusions a lot of people with this issue were using boolvalue in a different sense like a gui, I mostly want to use it as a player boolvalue not a gui.
I think I figured it out, I never printed what was inside the remote event, which was NIL so it never would update that value because I wasn’t sending it correctly. Thank you for your response it make me think of what was actually being called in the remote event and I did a print there to see.
Just for anyone who needs reference here is a real cheat sheet on how I fixed it after realizing the true root problem (thanks to ksus).
Remotes:WaitForChild("Quest"):WaitForChild("QuestAcceptedState").OnServerEvent:Connect(function(player)
print("server fired should change")
player.Quest.QuestAcceptedState.Value = true
print(player.Quest.QuestAcceptedState.Value)
end)
questProgress:GetPropertyChangedSignal("Value"):Connect(function()
print(player.Quest.QuestAcceptedState.Value)
if player.Quest.QuestAcceptedState.Value and player.Quest.QuestAcceptedState.Value == true then
if questTask.Value ~= nil then
if questProgress.Value >= questGoal.Value then
player:WaitForChild("PlayerGui"):WaitForChild("QuestUIButton"):WaitForChild("Frame").Visible = false
player:WaitForChild(questRewardCurrencyFolder.Value):WaitForChild(questRewardCurrency.Value).Value += questReward.Value
for i, v in pairs(quest:GetChildren()) do
if v:IsA("StringValue") then
v.Value = ""
elseif v:IsA("NumberValue") or v:IsA("IntValue") then
v.Value = 0
end
end
questAcceptedState = false
end
--mainQuestPart1 = true
end
end
end)