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

The conditions of the "if" statements were met but the code inside did not run, Why is that?

Asked by 4 years ago
01function CreatingParts(name, position)
02    local CreateNewPart = Instance.new("Part", workspace)
03    CreateNewPart.Anchored = true  
04    CreateNewPart.Position = position
05    CreateNewPart.Name = name
06    print("Done")
07end
08 
09 
10CreatingParts("Help", Vector3.new(4, 2.5, 43))
11CreatingParts("LOL", Vector3.new(5, 2.5, 43))
12CreatingParts("IHML", Vector3.new(6, 2.5, 43))
13CreatingParts("HMM", Vector3.new(7, 2.5, 43))
14CreatingParts("Meow", Vector3.new(8, 2.5, 43))
15CreatingParts("Bomb", Vector3.new(9, 2.5, 43))
View all 27 lines...

2 answers

Log in to vote
0
Answered by
SpiralRBX 224 Moderation Voter
4 years ago
Edited 4 years ago

Hi! I redid the script!

01function CreatingParts(name, position)
02    local CreateNewPart = Instance.new("Part", workspace)
03    CreateNewPart.Anchored = true
04    CreateNewPart.Position = position
05    CreateNewPart.Name = name
06    print("Done")
07end
08 
09CreatingParts("Help", Vector3.new(4, 2.5, 43))
10CreatingParts("LOL", Vector3.new(5, 2.5, 43))
11CreatingParts("IHML", Vector3.new(6, 2.5, 43))
12CreatingParts("HMM", Vector3.new(7, 2.5, 43))
13CreatingParts("Meow", Vector3.new(8, 2.5, 43))
14CreatingParts("Bomb", Vector3.new(9, 2.5, 43))
15CreatingParts("Solid", Vector3.new(10, 2.5, 43))
View all 32 lines...

TouchEnded will tell you when the part is not being touched!

Happy Scripting ^^

~~SpiralRBX

0
u gave the opposite colors but still thanks AriyanHacker29 22 — 4y
0
Oh my bad. Hope this helps! SpiralRBX 224 — 4y
0
and also why did that not work with the if statement? AriyanHacker29 22 — 4y
0
Touched is not a correct property. It has no true or false. SpiralRBX 224 — 4y
0
It is more of an event. SpiralRBX 224 — 4y
Ad
Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

If You Are Trying To Use The Touched Event Then This Is How It Would Work

01function CreatingParts(name, position)
02    local CreateNewPart = Instance.new("Part", workspace)
03    CreateNewPart.Anchored = true  
04    CreateNewPart.Position = position
05    CreateNewPart.Name = name
06    print("Done")
07end
08 
09CreatingParts("Help", Vector3.new(4, 2.5, 43))
10CreatingParts("LOL", Vector3.new(5, 2.5, 43))
11CreatingParts("IHML", Vector3.new(6, 2.5, 43))
12CreatingParts("HMM", Vector3.new(7, 2.5, 43))
13CreatingParts("Meow", Vector3.new(8, 2.5, 43))
14CreatingParts("Bomb", Vector3.new(9, 2.5, 43))
15CreatingParts("Solid", Vector3.new(10, 2.5, 43))
View all 25 lines...

I Hope This Is What You Meant

0
actually, i meant to make it change color to gold when i touched the part and if i didn't then it would turn red AriyanHacker29 22 — 4y
0
Oof My Bad Harry_TheKing1 325 — 4y

Answer this question