My script doesnt work and I used getplayerfromcharacter and changedhealth? Does anyone know how to fix this? Thanks
local character = game.Workspace.Player
local player = game.Players:GetPlayerFromCharacter(character)
local currentHealth = character.Humanoid
if player then
print("Player is " .. player.Name)
humanoid.HealthChanged:Connect(function(health)
local change = math.abs(currentHealth - health)
print("The humanoid's health "..(currentHealth > health and "decreased by " or "increased by ")..change..".")
currentHealth = health
workspace.MoneyValue.Value = workspace.MoneyValue.Value - 1401
else
print("Player doesn't exist!")
end

1 comment
what line