This seems like a very simple thing to do, however i have tried multiple methods to no avail.
[Core Games Equipment Tutorial - How To Understand & Use Equipment in Your Core Game - YouTube] <---- This is the tutorial in which i followed.
- I was able to implement the equipment and script the abilities no problem.
- However, upon unequipping, the object remains in the world. i was wondering as to how to destroy the equipment entirely?
This is the altered script in which i am currently using, any help will be more than appreciated <3
local primaryEquipment = script.parent function OnEquipped(equipment, player) if Object.IsValid(player) and player:IsA("Player") then player.diedEvent:Connect(OnPlayerDied) oldHealth = player.hitPoints oldMaxHealth = player.maxHitPoints player.hitPoints = "150" player.maxHitPoints = "100" stillEquiped = true HealthPlayer(player) end end function OnPlayerDied(player) for _, equipment in ipairs(player:GetEquipment()) do equipment:Unequip() end end function HealthPlayer(player) while Object.IsValid(player) and player:IsA("Player") and stillEquiped do if player.hitPoints < player.maxHitPoints then (ADD LINE HERE TO DESTROY OBJECT????) end Task.Wait(1) end end primaryEquipment.equippedEvent:Connect(OnEquipped)