I'm running into an issue with a lives script I recently obtained. It works perfectly whenever I'm a regular robloxian, but whenever I'm a 3D morph, It doesn't seem to work properly. 3D morphs require 5 models within the Morph: Arm1, Arm2, Leg1, Leg2 and Chest. Each one contains the parts to build the body parts within the models, and each one requires a brick called "middle" in order for them to function properly, so I'm guessing it's somthing to do with the Models within the 3D morphs.
Here's the script I'm working with to loose lives:
local db = false --Our debounce
function onTouched(hit)
if db == false then
db = true
local hitname = tostring(hit.Parent)
if game.Players:findFirstChild(hitname) then
local player = game.Players:findFirstChild(hitname)
local lives = player:findFirstChild("Lives")
lives.Value = lives.Value - 1
if lives.Value <= 0 then --If the player has lost all their lives then..
hit.Parent.Humanoid.Health = 0 --Kills the player
end
end
wait(1) -- Wait 1 second before losing a life again when touched.
db = false
end
end
script.Parent.Touched:connect(onTouched)

1 comment
Don't just post code! Provide a thorough explanation to your code. Same applies vice versa.