#Does anyone know how i can make 3 parts go invisible during an animation, then reappear?
1 messages · Page 1 of 1 (latest)
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)
there is a transparency attribute you can change
Try using task.wait
wym
oh.
im such an idiot guys
it was trying to find Basepart
and not a mesh part
nevermind it still doesnt work
your doing game.Workspace:WaitForChild("Gun1") even though they are in a "Rig" model
oh
I meant it if the animation markers were the problem you could use task.wait as a sub
Whyd you do "if Part", if your animating with it, wouldn't it be there
remove that and only check if it's a mesh part
yeah
ok sweet
one more try
still doesnt work dudeliet
same error
it just says "could not fetch"
check your mesh id's then or maybe reupload the mesh and see
also your use of "WaitForChild" is excessive
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
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)
do this first
oh i already did
in the gun transparency function print the gun instances so you see if it's the correct ones
ohh
add to the for loop print(part)
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
yes sir
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
sorry, change part.Transparency to Gun.Transparency
there we go
also bro you should've solved that yourself🥀
and i try again?
ye
** You are now Level 5! **
im stupid, REALLY stupid. 🥀
still uh
still doesnt work
😭
im starting to think it wasnt "Equip2" and it was "equip2"
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
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
try this and also read a print statement to the for loop
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
try now
you're never gonna believe it
what
it didnt work 💔
and you made sure that when your checking what changed it was the one in workspace not the one on your player