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

Script that creates a sphere doesn't work?

Asked by 5 years ago

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

01function fire()
02script.Parent.BrickColor = BrickColor.new("Bright red")
03bullet = Instance.new("Part", workspace)
04bullet.CustomPhysicalProperties = true
05bullet.Position = Vector3.new(-12.93, 11.995, -191.363)
06bullet.Shape = Enum.PartType.Ball
07wait(3)
08bullet:Destroy()
09end
10fire()

2 answers

Log in to vote
1
Answered by 5 years ago
Edited 5 years ago
01function fire()
02    script.Parent.BrickColor = BrickColor.new("Bright red")
03    bullet = Instance.new("Part", workspace)
04    bullet.CustomPhysicalProperties = true
05    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
06    bullet.Shape = Enum.PartType.Ball
07    wait(3)
08    bullet:Destroy()
09end
10 
11while true do -- since you say every 3 seconds, you need a "while" loop to work
12    wait()
13    fire()
14end
Ad
Log in to vote
0
Answered by
JesseSong 3916 Moderation Voter Community Moderator
5 years ago
Edited 5 years ago
01function fire() -- function
02    while true do -- while loop
03        wait(3) -- waits 3 seconds
04        local Part = Instance.new("Part",game.Workspace) -- makes a new part
05        Part.Shape =  Enum.PartType.Ball -- makes the Part a ball
06-- if you want to destroy it every 3 seconds then put
07-- Part:Destroy()
08 
09    end
10end
11fire()

Answer this question