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

Script that creates a sphere doesn't work?

I tried making a script where a sphere is spawned every 3 seconds, but it doesn't work. Here is the code.

function fire()
script.Parent.BrickColor = BrickColor.new("Bright red")
bullet = Instance.new("Part", workspace)
bullet.CustomPhysicalProperties = true
bullet.Position = Vector3.new(-12.93, 11.995, -191.363)
bullet.Shape = Enum.PartType.Ball
wait(3)
bullet:Destroy()
end
fire()

2 answers

✓ Accepted answer
function fire()
	script.Parent.BrickColor = BrickColor.new("Bright red")
	bullet = Instance.new("Part", workspace)
	bullet.CustomPhysicalProperties = true
	bullet.Position = CFrame.new(-12.93, 11.995, -191.363) -- I think its better to use CFrame.new, if this doesn't work, try pls change back to Vector3
	bullet.Shape = Enum.PartType.Ball
	wait(3)
	bullet:Destroy()
end

while true do -- since you say every 3 seconds, you need a "while" loop to work
	wait()
	fire()
end
function fire() -- function
	while true do -- while loop
		wait(3) -- waits 3 seconds
		local Part = Instance.new("Part",game.Workspace) -- makes a new part
		Part.Shape =  Enum.PartType.Ball -- makes the Part a ball
-- if you want to destroy it every 3 seconds then put 
-- Part:Destroy()
		
	end
end
fire()

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