How come this while loop doesnt work when I join the game? the value doesnt increase when i join the game
How come this while loop doesnt work when I join the game? the value doesnt increase when i join the game
This is not enough information, add some print statements and show the whole function, also tell me if there’s any errors your getting
As @JAcoboiskaka1121 said, can you please provide the full script?
Try adding the Player Added function
game.Players.PlayerAdded:Connect(function(plr)
local timequest=Instance.new("IntValue")
local quest=Instance.new("Folder")
quest.Name="Quest"
quest.Parent=plr
timequest.Name="TimeQuest"
timequest.Parent=quest
while wait(1) do
plr:WaitForChild("Quest"):WaitForChild("TimeQuest").Value=plr:WaitForChild("Quest"):WaitForChild("TimeQuest").Value+1
end
end)
important, you must use a server script, this will not work in a local script
sorry for the late response, this is the whole local script
local exquest = game.ReplicatedStorage.Remotes.ExQuest
local qstart = script.Parent.QStart
local close = script.Parent.Parent.Quests.Close
local quests = script.Parent.Parent.Quests.Questes
local player = game.Players.LocalPlayer
qstart.MouseButton1Click:Connect(function(player)
script.Parent.Parent.Quests.Visible = true
end)
close.MouseButton1Click:Connect(function()
script.Parent.Parent.Quests.Visible = false
end)
quests:FindFirstChild("Quest1").Progress.Text = player.Quests.StudQuest.Value.."/".."50000"
quests:FindFirstChild("Quest2").Progress.Text = player.Quests.WinQuest.Value.."/".."2"
quests:FindFirstChild("Quest3").Progress.Text = player.Quests.TimeQuest.Value.."/".."15"
while wait(1) do
player:WaitForChild("Quests"):WaitForChild("TimeQuest").Value = player:WaitForChild("Quests"):WaitForChild("TimeQuest").Value + 1
end
Your problem is that you are trying to add to the value of 1 in a local script, try to create a server script and add to the value of +1 through it
this worked for me after using the server script, thanks for the advice
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.