--int value
game.ReplicatedStorage.valueChangeRemoteEvents.intValue.OnServerEvent:Connect(function(plr, value, number, valueInstanceOrNot)
if valueInstanceOrNot == true then --.Value needed if its a value instance
print("value")
value.Value = number
elseif valueInstanceOrNot == false then --otherwise we can just set the value equal to the number since its a property
print("not value")
value = number
print("finished")
end
end)
When called, the prints suggest everything is totally normal- two “not instances”, and two “finished”. They also print at the time when the remote event should have been fired, which means that firing the remote event is also working perfectly.
No errors, nothing.
That script is in serverscriptservice, connected to a remote event in replicatedstorage. The point is to be able to change values on the server from the client. Of course, I want it to be able to change any intvalue, if it’s a property or if it’s a value instance. Because of this, I check if it is a value instance through the last parameter. If true, I say value.Value, otherwise, I just set the value.
Here’s where I call this remote event:
--setting health
healthLevel:GetPropertyChangedSignal("Value"):Connect(function()
game.ReplicatedStorage.valueChangeRemoteEvents.intValue:FireServer(game.Players.LocalPlayer.Character.Humanoid.MaxHealth, calculateHealthAndStamina(healthLevel), false)
game.ReplicatedStorage.valueChangeRemoteEvents.intValue:FireServer(game.Players.LocalPlayer.Character.Humanoid.Health, calculateHealthAndStamina(healthLevel), false)
end)
--setting stamina
staminaLevel:GetPropertyChangedSignal("Value"):Connect(function()
game.ReplicatedStorage.valueChangeRemoteEvents.intValue:FireServer(game.Players.LocalPlayer.Character.Stamina, calculateHealthAndStamina(staminaLevel), true)
end)
Both in a localscript in startercharacterscripts.
They are supposed to change a stamina value (which is an instance in your character) and your health (which is a property of your humanoid).
MY PROBLEM
The stamina value changes. Nothing happens to the health.
As stated before, no errors. What’s going wrong?
