#Does anyone know how i can make 3 parts go invisible during an animation, then reappear?

1 messages · Page 1 of 1 (latest)

inland mural
#

I've been using animation events to trigger it once which tries to make its transparency 1, then another trigger which makes it 0 again, but its not working and im gonna explode

#

local character = script.Parent
local animator = character:WaitForChild("Humanoid"):WaitForChild("Animator")

local gunParts = {
game.Workspace:WaitForChild("Gun1"),
game.Workspace:WaitForChild("Gun2"),
game.Workspace:WaitForChild("Gun3")
}

local function setGunTransparency(value)
for _, part in ipairs(gunParts) do
if part and part:IsA("BasePart") then
part.Transparency = value
end
end
end

animator.AnimationPlayed:Connect(function(track)
track:GetMarkerReachedSignal("Equip1"):Connect(function()
setGunTransparency(1)
end)

track:GetMarkerReachedSignal("Equip2"):Connect(function()
    setGunTransparency(0)
end)

end)

smoky sierra
#

there is a transparency attribute you can change

novel mural
#

Try using task.wait

inland mural
#

oh.

#

im such an idiot guys

#

it was trying to find Basepart

#

and not a mesh part

#

nevermind it still doesnt work

novel mural
inland mural
#

oh trust me i have a copy in the workspace too

#

its not doing nun either!

novel mural
#

oh

novel mural
# inland mural wym

I meant it if the animation markers were the problem you could use task.wait as a sub

inland mural
#

yeaahh but like..

#

noooooooooo

novel mural
inland mural
#

idk im not very smart cro

#

chat gpt carried half of this

novel mural
#

remove that and only check if it's a mesh part

novel mural
#

stop prompting so much

inland mural
#

?

novel mural
#

yeah

inland mural
#

ok sweet

#

one more try

#

still doesnt work dudeliet

#

same error

#

it just says "could not fetch"

novel mural
#

check your mesh id's then or maybe reupload the mesh and see

inland mural
#

yeah i suppose

#

because its only doing it on ONE of them

novel mural
inland mural
#

okay thats

#

strange

#

the ID in the error isnt even like..

#

any of the gun parts actually

#

i hate scripting!

#

okay so

#

theres no errors with it

#

it just doesnt work

#

sweet

#

okay ill try the wait thing

novel mural
#

add print statements to your "animation marker reached" events and see if it's actually running, and slo in the SetGunTransparency, add something like |

print("Changed ", part, "'s, transparency to ", value)
novel mural
novel mural
#

in the gun transparency function print the gun instances so you see if it's the correct ones

inland mural
#

ohh

novel mural
#

add to the for loop print(part)

inland mural
#

okay so

#

its just not going off actually

novel mural
#

change

    for _, part in ipairs(gunParts) do
        if part and part:IsA("BasePart") then
            part.Transparency = value
        end
    end

to

    for Gun in gunParts do
        part.Transparency = value
    end
inland mural
#

yes sir

novel mural
#

also there isn't really a point in checking if it's a mesh part cause you, yourself already defined what the guns were in the table

inland mural
#

whoops i forgot to get rid of that one end

novel mural
#

sorry, change part.Transparency to Gun.Transparency

inland mural
#

there we go

novel mural
#

also bro you should've solved that yourself🥀

inland mural
#

and i try again?

novel mural
#

ye

brazen jewelBOT
#

studio** You are now Level 5! **studio

inland mural
#

still uh

#

still doesnt work

#

😭

#

im starting to think it wasnt "Equip2" and it was "equip2"

novel mural
#

in the table get rid of the WaitForChild thingy and make sure that it is actually getting the right thing

#

so game.workspace:WaitForChild("Gun1") should just be game.workspace.Gun1

inland mural
#

HOPAGRUGAEGAERG

#

AAREGERO[HGAERHG

#

THEY HAD A SPACE.

#

THEY HAD A SPACE IN THEM!!

#

AER[JOGIERHG[AOEURGH, OERHO,G[UEHCRUOG,R

#

NOW.

#

WE.

#

TRY.

#

oh ok it still doesnt work actually

novel mural
inland mural
#

oh

#

new pop-up

#

still doesnt work though

#

sighs

novel mural
#

ima let you figure this out

inland mural
#

oh wait the

#

print things

#

gneorgng,egrg,

novel mural
#

your not using the function at all in your code

#

and also in the setguntransparency thingy you should make the gun's transparency be set to your value attribute, not 1

inland mural
#

ok

#

oooone more shot

novel mural
#

try now

inland mural
#

you're never gonna believe it

novel mural
#

what

inland mural
#

it didnt work 💔

novel mural
#

and you made sure that when your checking what changed it was the one in workspace not the one on your player

inland mural
#

i feel as if this isnt worth doing atp

#

yep

#

got them right here