I want the health to display on the text label and the text label to go down but it will not and the <= 0 then does not work./
Here are both scripts
local frame = script.Parent
local measure = frame.Measure
local label = frame.LabelText
local Health = script.Parent.Parent.Parent.Health
local Rock = script.Parent.Parent.Parent.Parent.Rock
if Health.Value <= 0 then
Rock.Transparency = 0
Rock.CanCollide = false
print("health is 0 or under")
end
label.Text = Health.Value .. "/" .. Health.Value
measure.Size = UDim2.new()
script 2
local Damage = script.Parent.Damage.Value
local Tool = script.Parent
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local Rock = game.Workspace.Rock
local RockValue = script.Parent.Rock.Value
if RockValue == true then
mouse.Button1Down:Connect(function()
local target = mouse.Target
--print(target)
if target.Name == "Rock" then
local distance = (target.Position - player.Character.HumanoidRootPart.Position).Magnitude
if distance <= 32 then
Rock.Health.Value -= Damage
print("Found the target rock within 32")
else
print("To far away")
end
end
end)
end