Hey there! So I’ve made a pretty complicated GUI, with a Modules folder with scripts, a MainModule script, and a big Events folder, along with some server-side code as well, but it isn’t working. The little bar won’t update, the percentage won’t change, etc.
My MainModule localscript, inside a ScrollingFrame, inside the ScreenGui:
local possibleQuests = {
["QuestOne"] = "Bragging Rights",
["QuestTwo"] = "Winner's Pool",
["QuestThree"] = "Campfire",
["QuestFour"] = "Setting Up Camp",
["QuestFive"] = "Lumberjack",
["QuestSix"] = "Play-A-Day"
}
local possibleDescriptions = {
["TextOne"] = "Win a game of Alone!",
["TextTwo"] = "Win 5 games of Alone!",
["TextThree"] = "Set up a campfire in Alone!",
["TextFour"] = "Set up 5 tents Alone!",
["TextFive"] = "Mine 30 trees!",
["TextSix"] = "Play for a day overall in Alone!"
}
local questRandom = math.random(1, 6)
if questRandom == 1 then
script.Parent.QuestName.Text = "Bragging Rights"
script.Parent.Text.Text = "Win a game of Alone!"
script.Parent.Values.Quest.Value = 1
elseif questRandom == 2 then
script.Parent.QuestName.Text = "Winner's Pool"
script.Parent.Text.Text = "Win 5 games of Alone!"
script.Parent.Values.Quest.Value = 2
elseif questRandom == 3 then
script.Parent.QuestName.Text = "Campfire"
script.Parent.Text.Text = "Set up a campfire in Alone!"
script.Parent.Values.Quest.Value = 3
elseif questRandom == 4 then
script.Parent.QuestName.Text = "Setting Up Camp"
script.Parent.Text.Text = "Set up 5 tents Alone!"
script.Parent.Values.Quest.Value = 4
elseif questRandom == 5 then
script.Parent.QuestName.Text = "Lumberjack"
script.Parent.Text.Text = "Mine 30 trees!"
script.Parent.Values.Quest.Value = 5
elseif questRandom == 6 then
script.Parent.QuestName.Text = "Play-A-Day"
script.Parent.Text.Text = "Play for a day overall in Alone!"
script.Parent.Values.Quest.Value = 6
end
Next, my LocalScript inside Modules folder:
local GUI = script.Parent.Parent.Parent.Parent
local MainFrame = script.Parent.Parent.Parent
local Folder = script.Parent.Parent
local QName = Folder.Name
local QText = Folder.Text
local overall = Folder.Unfilled
local completed = Folder.Filled
local completedText = Folder.AmountDone
local quest = Folder.Values.Quest
game.ReplicatedStorage.DailyChallenges.ChallengeOneValueChanged.OnClientEvent:connect(function()
print("hi")
script.Parent.Parent.Events.QuestOne:Fire()
end)
game.ReplicatedStorage.DailyChallenges.ChallengeOneValueChanged.OnClientEvent:connect(function()
print("hi")
script.Parent.Parent.Events.QuestTwo:Fire()
end)
game.ReplicatedStorage.DailyChallenges.ChallengeThreeValueChanged.OnClientEvent:connect(function()
print("hi")
script.Parent.Parent.Events.QuestThree:Fire()
end)
game.ReplicatedStorage.DailyChallenges.ChallengeFourValueChanged.OnClientEvent:connect(function()
print("hi")
script.Parent.Parent.Events.QuestFour:Fire()
end)
game.ReplicatedStorage.DailyChallenges.ChallengeFiveValueChanged.OnClientEvent:connect(function()
print("hi")
script.Parent.Parent.Events.QuestFive:Fire()
end)
game.ReplicatedStorage.DailyChallenges.ChallengeSixValueChanged.OnClientEvent:connect(function()
print("hi")
script.Parent.Parent.Events.QuestSix:Fire()
end)
quest.Changed:Connect(function()
print("new quest value found, now it is", quest.Value)
if quest.Value == 1 then
print("Player's new quest is Quest number 1")
local CurrentWins = game.Players.LocalPlayer.Wins
local NeededWins = 1
script.Parent.Parent.Events.QuestOne.Event:Connect(function()
script.Parent.Parent.Filled.Size.X = CurrentWins.Value / NeededWins
script.Parent.Parent.AmountDone.Text = CurrentWins.Value / NeededWins * 100 .. "%"
end)
elseif quest.Value == 2 then
print("Player's new quest is Quest number 2")
local CurrentWins = game.Players.LocalPlayer.Wins.Value
local NeededWins = 5
script.Parent.Parent.Events.QuestTwo.Event:Connect(function()
script.Parent.Parent.AmountDone.Text = CurrentWins.Value / NeededWins * 100 .. "%"
script.Parent.Parent.Filled.Size.X = CurrentWins.Value / NeededWins
end)
elseif quest.Value == 3 then
print("Player's new quest is Quest number 3")
local CurrentWins = game.Players.LocalPlayer.FiresPlaced.Value
local NeededWins = 1
script.Parent.Parent.Events.QuestThree.Event:Connect(function()
script.Parent.Parent.AmountDone.Text = CurrentWins.Value / NeededWins * 100 .. "%"
script.Parent.Parent.Filled.Size.X = CurrentWins.Value / NeededWins
end)
elseif quest.Value == 4 then
print("Player's new quest is Quest number 4")
local CurrentWins = game.Players.LocalPlayer.TentsPlaced.Value
local NeededWins = 5
script.Parent.Parent.Events.QuestFour.Event:Connect(function()
script.Parent.Parent.AmountDone.Text = CurrentWins.Value / NeededWins * 100 .. "%"
script.Parent.Parent.Filled.Size.X = CurrentWins.Value / NeededWins
end)
elseif quest.Value == 5 then
print("Player's new quest is Quest number 5")
local CurrentWins = game.Players.LocalPlayer.TreesMined.Value
local NeededWins = 30
script.Parent.Parent.Events.QuestFive.Event:Connect(function()
script.Parent.Parent.AmountDone.Text = CurrentWins.Value / NeededWins * 100 .. "%"
script.Parent.Parent.Filled.Size.X = CurrentWins.Value / NeededWins
end)
elseif quest.Value == 6 then
print("Player's new quest is Quest number 6")
local CurrentWins = game.Players.LocalPlayer.SecondsPlayed.Value
local NeededWins = 86400
script.Parent.Parent.Events.QuestSix.Event:Connect(function()
script.Parent.Parent.AmountDone.Text = CurrentWins.Value / NeededWins * 100 .. "%"
script.Parent.Parent.Filled.Size.X = CurrentWins.Value / NeededWins
end)
end
end)
And finally my server-side code:
game.Players.PlayerAdded:Connect(function(player)
local Wins = player:WaitForChild("Wins")
local Fires = player:WaitForChild("Fires")
local Tents = player:WaitForChild("Tents")
local Trees = player:WaitForChild("Trees")
local Seconds = player:WaitForChild("Seconds")
print("Success! Wins, Fires, Tents, Trees, and Seconds variables were defined, loaded, and rendered successfully in ",player.Name,"! Ready for Changed functions.")
Wins.Changed:Connect(function()
print("Wins changed to ", Wins.Value, "firing.")
game.ReplicatedStorage.DailyChallenges.ChallengeOneValueChanged:FireClient(player)
end)
Fires.Changed:Connect(function()
print("Fires changed to ", Fires.Value, "firing.")
game.ReplicatedStorage.DailyChallenges.ChallengeThreeValueChanged:FireClient(player)
end)
Tents.Changed:Connect(function()
print("Tents changed to ", Tents.Value, "firing.")
game.ReplicatedStorage.DailyChallenges.ChallengeFourValueChanged:FireClient(player)
end)
Trees.Changed:Connect(function()
print("Trees changed to ", Trees.Value, "firing.")
game.ReplicatedStorage.DailyChallenges.ChallengeFiveValueChanged:FireClient(player)
end)
Seconds.Changed:Connect(function()
print("Seconds changed to ", Seconds.Value, "firing.")
game.ReplicatedStorage.DailyChallenges.ChallengeSixValueChanged:FireClient(player)
end)
end)
I want the system to update the bar, and the percentage as soon as the values change.
A video of the problem occurring:
Any help is appreciated. Thanks so much! (Going to bed, will read all replies in the morning.)