The script works but for some players the rewards do not save to the “player.DailyReward.Day1.Value = reward1” etc.
I think I know why, but the things I try to do does not seem to work. I tried to put WaitForChild in the script or am I doing this wrong? I did also put the player.CharacterAdded:Connect(function(char)
–TEST
end)
in there but it did not work. I know another way to fix it but it’s not a good way, so that’s why I need your help!
Here is the script, it’s not the full script though, only the part I need help with.
else
--New player
print("New Player")
player.DailyReward.DailyRewardDay.Value = 1
local reward1 = possibleRewardsDay1[math.random(1,#possibleRewardsDay1)]
local reward2 = possibleRewardsDay2[math.random(1,#possibleRewardsDay2)]
local reward3 = possibleRewardsDay3[math.random(1,#possibleRewardsDay3)]
local reward4 = possibleRewardsDay4[math.random(1,#possibleRewardsDay4)]
local reward5 = possibleRewardsDay5[math.random(1,#possibleRewardsDay5)]
local reward6 = possibleRewardsDay6[math.random(1,#possibleRewardsDay6)]
local reward7 = possibleRewardsDay7[math.random(1,#possibleRewardsDay7)]
local dr = player:WaitForChild("DailyReward")
dr:WaitForChild("Day1")
dr:WaitForChild("Day2")
dr:WaitForChild("Day3")
dr:WaitForChild("Day4")
dr:WaitForChild("Day5")
dr:WaitForChild("Day6")
dr:WaitForChild("Day7")
dr:WaitForChild("Day7Special")
player.DailyReward.Day1.Value = reward1
player.DailyReward.Day2.Value = reward2
player.DailyReward.Day3.Value = reward3
player.DailyReward.Day4.Value = reward4
player.DailyReward.Day5.Value = reward5
player.DailyReward.Day6.Value = reward6
if reward7 == "Captain" or reward7 == "Elite" or reward7 == "Master" or reward7 == "BlackCrowns" or reward7 == "EarthGlobes" then
player.DailyReward.Day7Special.Value = reward7
elseif reward7 ~= "Captain" or reward7 ~= "Elite" or reward7 ~= "Master" or reward7 ~= "BlackCrowns" or reward7 ~= "EarthGlobes" then
player.DailyReward.Day7.Value = reward7
end
game.ReplicatedStorage.Remotes.ShowDailyReward:FireClient(player,hourWait,reward1)
local connection
connection = game.ReplicatedStorage.Remotes.ClaimReward.OnServerEvent:Connect(function(triggeringPlayer)
player.DailyReward.DailyRewardDay.Value = 2
if triggeringPlayer == player then
print("Reward Claimed")
player.leaderstats.Bits.Value = player.leaderstats.Bits.Value + reward1
dailyRewardData:SetAsync(player.UserId.."_DailyReward",os.time())
connection:Disconnect()
end
end)
end
player.CharacterAdded:Connect(function(char)
--TEST
end)
end)
If you have any questions, please ask me, I hope it is not too confusing! thanks for the help,
/Xsodar