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 4 years ago

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

Log in to vote
1
Answered by 4 years ago
Edited 4 years ago
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
Ad
Log in to vote
0
Answered by
JesseSong 3916 Moderation Voter Community Moderator
4 years ago
Edited 4 years ago
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()

Answer this question