So i'm working into a Apocalypse - Rpg game and i can't figure this out!

There are 3 IntValues into Players --> Princess_Fexi007 --> ThirstVal HungerVal and MedicineVal.

I can't figure out how to save them they go from 100 to 0 if i rejoin they go up at 100 how do i save them ?

The scrip that creates the IntValues Example the HungerVal one. local HG = script.Parent local Text = HG:WaitForChild("Back"):WaitForChild("Text") local Plr = game.Players.LocalPlayer

repeat wait() until Plr.Character

local Hum = Plr.Character:WaitForChild("Humanoid") local MaxHunger = 100 local DecreaseRate = 8 -- 8 seconds = -1 hunger local HungerValue

if Plr:FindFirstChild("HungerVal") then HungerValue = Plr.HungerVal HungerValue.Value = MaxHunger else Instance.new("IntValue", Plr).Name = "HungerVal" Plr.HungerVal.Value = MaxHunger HungerValue = Plr.HungerVal end

HungerValue.Changed:connect(function() Text:TweenSize(UDim2.new(HungerValue.Value/MaxHunger,0, 1,0), "Out", "Linear", .2, true) end)

while wait(DecreaseRate) do if HungerValue.Value - 1 >= 0 then HungerValue.Value = HungerValue.Value - 1 end

if HungerValue.Value == 0 then
	repeat wait(1)
		Hum.Health = Hum.Health - 2
	until HungerValue.Value > 0 or Hum.Health <= 0
end

end

1 comment

0

eof