I want to make it so the lower the health on a player, the slower they walk. I used a remoteEvent that fires whenever the health changes. that works perfectly fine. The issue is the actual changing of the walkspeed value. I made it so it prints the walkspeed, and for example, when my health is at 20, the walkspeed print is 4. That is working as intended. When I walk though, I am not affected at all, and when I check explorer, it says my walkspeed is normal, however the script says otherwise. anyone know why?
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local HealthChanged = ReplicatedStorage.RemoteEvents.HealthChanged
HealthChanged.OnServerEvent:Connect(function(player)
local Hum = player.Character:WaitForChild("Humanoid")
local Health = Hum.Health
local Walkspeed = Hum.WalkSpeed
local HealthChanged = ReplicatedStorage.RemoteEvents.HealthChanged
Walkspeed = Health / 5
print(Walkspeed)
end)