Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Transparency script does not finish all lines?

Asked by 5 years ago
Edited 5 years ago

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.

0
Edit:- fixed code block. Pls preview your question before posting it so see how it will be shown on the site. User#5423 17 — 5y
0
Whoops, I did preview it however this weird thing happened. I will fix it ASAP. Bgonzalezseeya11 27 — 5y
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"]. User#5423 17 — 5y
0
Thank you. I will see if this works. Bgonzalezseeya11 27 — 5y

2 answers

Log in to vote
-1
Answered by 5 years ago

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 ! :)

0
keep the dot thats after name CommanderCaubunsia 126 — 5y
0
o.o User#5423 17 — 5y
0
WHY DID I GET DOWNVOTE!?!?!!?!?! CommanderCaubunsia 126 — 5y
0
O.O smh... Ziffixture 6913 — 5y
0
Soo.....   script["Parent"]["Left Leg"]["Transparency"]=0--//whyuusedotandspace?? Ziffixture 6913 — 5y
Ad
Log in to vote
0
Answered by 5 years ago

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.

Answer this question