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

Why Won't This Work Help Anyone?

I Wanted To Make A Part Spawner That Can Spawn More Than 2 Things With A Chance Rate I Tried To Make One But, It won't work any answers?

function kok()
	local p = Instance.new("Part")
	p.Position = script.Parent.Position
	p.Name = "Rock"
	p.Parent = script.Parent
function lol()
	local s = Instance.new("Part")
	s.Position = script.Parent.Position
	s.Name = "Stuff"
	s.Parent = script.Parent
	end
end
while true do
f = math.random(1,2)
if f == 1 then
kok()
elseif f == 2 then
lol()
wait(1.5)
end
end

1 comment

0

It would help if you said what it displayed in the Output

1 answer

✓ Accepted answer
function kok()
    local p = Instance.new("Part")
    p.CFrame = CFrame.new(0,0,0) -- Add Position
    p.Name = "Rock"
    p.Parent = script.Parent
print("1")
end
function lol()
    local s = Instance.new("Part")
    s.CFrame = CFrame.new(0,0,0) -- Add Position
    s.Name = "Stuff"
    s.Parent = script.Parent
print("2")
 end
while true do
f = math.random(1,2)
if f == 1 then
kok()
elseif f == 2 then
lol()
end
wait(1.5)
end

1 comment

0

remove 6th and 13th lines

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