#wont go transparent

22 messages · Page 1 of 1 (latest)

wind lodge
#

does anyone know why this script wont work
local hitbox = script.Parent
local cd = Instance.new("ClickDetector", hitbox)
local health = 10

script.Parent.ClickDetector.MouseClick:Connect(function()
health -= 1
print(health)
end)

if health <= 0 then
hitbox.Position = Vector3.new(0,1,0)
end
the first part works where it takes away each health on click and prints it right but whenthe health = 0 it doesent move

opal crane
#

is the*

#

In a player/NPC?

wind lodge
#

a part

opal crane
wind lodge
#

i was trying to get it to go transparent at first but that dident work then i tried moving it and that dident work either

wind lodge
#

if its not anchored it falls to peices when i run it

opal crane
#

@wind lodge I think you forgot to capitalize the "h" in Health

#

Try fixing capitalization and then try again

wind lodge
#

none of them have a capital h

opal crane
#

Hold on, let me test your script rq

#

@wind lodge I got it working!
You need to put the part where it changes properties inside the clicked function like this

local hitbox = script.Parent
local cd = Instance.new("ClickDetector", hitbox)
local health = 10

script.Parent.ClickDetector.MouseClick:Connect(function() -- Over here!
    health -= 1
    print(health)
    if health <= 0 then -- Over here!
        hitbox.Position = Vector3.new(0,1,0)
    end
end)

wind lodge
#

ohh

#

let me test

#

thank you

#

it works

opal crane
wind lodge
# opal crane Np

do you know if its possable to make a group of parts transparrent

cold canyon
#

Use a for i,v in pairs(model:GetChildren()) do and then check if value (v) is a part and if so make it transparent. But make sure to group the parts you want transparent together

wind lodge