Hi, I made this script,
-- Made by KenzaShadow -- local HealBall = script.Parent function onEquip() local Player = game:GetService'Players'.LocalPlayer if (Player ~= nil) then Player.Humanoid.MaxHealth = 200 wait(1) Player.Humanoid.Health = Player.Humanoid.MaxHealth end end HealBall.Equipped:connect(onEquip)
and the Output says, "Equipped is not a valid member of part" The Handle is this scripts parent, and The Handle's Parent is a Tool Instance. Thanks for the Help.
The Equipped
event is fired on the Tool, not the Handle.
Also, the player's Humanoid is located in their character, not the actual player. You can access the Character using the Character
property of the player.
Fixed Code:
-- Made by KenzaShadow -- local HealBall = script.Parent function onEquip() local Player = game:GetService'Players'.LocalPlayer if (Player ~= nil) then Player.Character.Humanoid.MaxHealth = 200 --The character's humanoid, not the player's. wait(1) Player.Character.Humanoid.Health = Player.Humanoid.MaxHealth --The character's humanoid, not the player's. end end HealBall.Parent.Equipped:connect(onEquip) --The Handle's parent.
If I helped you out, be sure to accept my answer!
Equipped is not an event for Parts, because you don't equip Parts. It's an event for Tools. Therefore you just have to use the tool to access the event.
local HealBall = script.Parent.Parent