Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Transparency script does not finish all lines?

I am not well experienced in scripting however this is the one true place I can understand.

Background: I am creating a model that starts an NPC as a child state and a few seconds later turns into an adult/adolescent. The way I am deciding to do this is with this script.

wait(5)
script.Parent.Head.Transparency = 0                                                                                         
script.Parent.Left Arm.Transparency = 0                                                                                         
script.Parent.Left Leg.Transparency = 0                                                                                         
script.Parent.Right Arm.Transparency = 0                                                                                         
script.Parent.Right Leg.Transparency = 0                                                                                         
script.Parent.Torso.Skull.Transparency = 0                                                                                         
script.Parent.Torso.Carapace.Transparency = 0                                                                                         
script.Parent.Torso.Carapace1.Transparency = 1                                                                                         
script.Parent.Torso.Tail.Transparency = 0                                                                                         
script.Parent.Torso.Tail1.Transparency = 1                                                                                         
script.Parent.Torso.torso.Transparency = 0                                                                                         
script.Parent.Torso.Spines.Transparency = 0   

The way this works is that there are two appearances in the model and the adult appearance is transparent for a given amount of time and then becomes visible as the initial appearance goes invisible. When I try this script on my NPC, it will only go up to line 2, and the head will be visible but everything else is invisible. I do understand that the spaces in the script affect it and I do not know what do I replace the spaces with.

Issue (just in case): The spaces in the script prevent it from working, what do i replace them with?

Edit 1: Inserted code block.

4 comments

0

Edit:- fixed code block. Pls preview your question before posting it so see how it will be shown on the site.

0

Whoops, I did preview it however this weird thing happened. I will fix it ASAP.

0

As shown under Dictionaries https://developer.roblox.com/articles/Table#Dictionaries You need to use tbl.["some string"] when the index you are using includes a space. tbl.something is just syntactic cand for tbl["something"].

0

Thank you. I will see if this works.

2 answers

✓ Accepted answer

Hello, there is a simple issue to understand, spaces and . and those types of keyboard characters do not work when scripting, this is why your script does not function properly, to fix this problem, simply take dot away thats before the name and put name inside this --> [""]

for example, a line should like like this

script.Parent["Left Leg"].Transparency = 0 

and not

script.Parent.Left Leg.Transparency = 0 

I added [" "], hope this helps ! :)

5 comments

0

keep the dot thats after name

0

o.o

0

WHY DID I GET DOWNVOTE!?!?!!?!?!

0

O.O smh...

0

Soo.....   script["Parent"]["Left Leg"]["Transparency"]=0--//whyuusedotandspace??

Thanks to CommanderCaubunsia I was able to fix this script. Here is the script II have modified.

wait(5)
script.Parent.Head.Transparency = 0
script.Parent['Left Arm'].Transparency = 0
script.Parent['Left Leg'].Transparency = 0
script.Parent['Right Arm'].Transparency = 0
script.Parent['Right Leg'].Transparency = 0
script.Parent.Torso.Skull.Transparency = 0
script.Parent.Torso.Carapace.Transparency = 0
script.Parent.Torso.Carapace1.Transparency = 1
script.Parent.Torso.Tail.Transparency = 0
script.Parent.Torso.Tail1.Transparency = 1
script.Parent.Torso.torso.Transparency = 0
script.Parent.Torso.Spines.Transparency = 0

She was on the right path however you only use (') instead of ("). The script works beautifully. Thank you all for your help.

This discussion is preserved as it was. New answers, comments, and votes are closed.