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

Why is this script not summoning a new part when its supposed to despite errors?

so i need this to sorta make a rain of parts but for some reason no parts are appearing and there are no errors pls help

function part()
while true do 
wait(1.111111111111111111)
local lick = Instance.new("Part",workspace)
lick = true
lick.BrickColor = BrickColor.new("Bright orange")
lick.Shape = "Sphere"
lick.Material = "Neon"
lick.Name = "licker liper"
lick.Size = Vector3.new(math.random(0.75,1.5),math.random(1,2),math.random(0.75,1.5))
lick.Position = Vector3.new(math.random(-13.86,24.71),math.random(22.33,25.33),math.random(-9.76,-21.05))
end
end

2 comments

1

To make your code better, don't use the parent argument of "Instance.new()". https://devforum.roblox.com/t/psa-dont-use-instance-new-with-parent-argument/30296

0

Yeah I just ran some test. I was unaware of this. I recommend removing the ",workspace" part of the instance.new("Part") and just defining lick.Parent = game.Workspace

1 answer

✓ Accepted answer
--function part()- not needed for a loop
while true do 
wait(1.111111111111)--i mean just use wait(1) but this is fine
local lick = Instance.new("Part",workspace)
--lick = true -- don't set lick equal to true here and then ask lick to have an index of BrickColor and Shape and Material. Won't work.
lick.BrickColor = BrickColor.new("Bright orange")
lick.Shape = "Block" -- also i changed this to block because you had it as sphere and that isn't part of the index for shape
lick.Material = "Neon"
lick.Name = "licker liper"
lick.Size = Vector3.new(math.random(0.75,1.5),math.random(1,2),math.random(0.75,1.5))
lick.Position = Vector3.new((math.random(-13.86, 24.71)),(math.random(22.33,25.33)),(math.random(-21.05, -9.76))) -- here I added parentheses 
--just because i wanted them for the sake of how i code and understand math
--the problem with stating math.random(-9.76,-21.05) is the fact that -21.05 is your upper limit and -9.76 is your lower. The upper limit can't be smaller 
--than the lower limit
end
--end -- removed since no longer need the function 

Here I fixed some things with it. Hope this helps. I added comments to the actual code.

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