im pretty bad at explaining things, but heres my problem im facing rn
i made a stats system recently and there is a stat to change health and its called “Vitality”, every time a point is added the player’s health will increase by 15
im increasing the player’s maxhealth locally (might be the problem),
for example, i joined the game and gained 5 points, i use all the 5 points to increase maxhealth, and my health would be 100 + 75, my total health would be 175, so heres the main problem,
the player health doesnt regen over 100 ( stuck at 100/175 ) if i take 10 damages, the health will be 90/175 and will only recover until 100
what if i change the player health to 175/175 in properties? when i take 10 damages, the health automatically changes to 90/175 and will regen to 100 too. Cant fix this for almost a day
what should i do to fix this? might as well do the whole thing for me
If for some reason that’s the case, you should handle the Player’s Health on the server side via firing a RemoteEvent from the client to the server to change the Health that way
Pretty much when your Gui detects the Health being changed, fire a RemoteEvent which will handle client-server transportation
I don’t know how your script is made, so I’m not certain on when your event fires but I’m assuming you could do something like this inside your GuiObject:
--LocalScript
local Event = game.ReplicatedStorage:WaitForChild("RemoteEvent")
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
--Instead of increasing your health on the client side, fire a RemoteEvent to the server side
Event:FireServer()
--ServerScript inside ServerScriptService
local Event = game.ReplicatedStorage:WaitForChild("RemoteEvent")
Event.OnServerEvent:Connect(function(Player)
local Char = Player.Character
Char.Humanoid.Health += 1
end)
Also just checking to make sure, but you’re wanting to have your own health regeneration system? Since you seem to have the auto-regen script disabled
wait… i have been doing confused math with the value until now… when i looked at your script, just remembered i can do it simple in a simple way LMAO thanks, and it fixed my issue btw