local potion = script.Parent
local character
potion.Handle.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("HumanoidRootPart") then
potion.Parent = hit.Parent
for i,v in pairs(potion:GetChildren()) do
if v:IsA("Part") or v:IsA("UnionOperation") then
v.Anchored = false
v.CanCollide = false
character = hit.Parent
end
end
end
end)
local humanoid
while wait() do
if character:FindFirstChild("Humanoid") then
humanoid = character.Humanoid
break
end
end
potion.Activated:Connect(function()
if humanoid then
if humanoid.Health <= 99 then
local info = TweenInfo.new(1)
local tween = game:GetService("TweenService"):Create(humanoid,info,{Health = 100})
tween:Play()
potion:Destroy()
end
end
end)
I made a health potion script. It's not getting the humanoid touched, therefore the character is still nil? The activated function works all right. What's the issue here?

2 comments
I fixed it.
I fixed it.