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

a script inside of a spawnblock wont spawn an entity, can i get help?

Asked by 6 years ago

Hello! I am still trying to learn LUA, and I've created a block with a script inside of it. The script is supposed to wait a peroid of time, then spawn a noob, then wait, and repeat. I'm pretty sure there is a big error in my code, but i'm still learning, anyway here is the script:

game.workspace.lighting.Noob:clone
wait(0.5)
repeat

Please help!

0
You didn't tell the script when to execute. A while wait() do or a while true do should fix that TiredMelon 405 — 6y

2 answers

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

You were very close! :D Remember to put capital letters on "Workspace" and "Lighting". Making a loop may be easier.

while true do
game.Workspace.Lighting.Noob:Clone()
wait(0.5)
end

I'm not a professional scripter, but I think this may fix your problem. ;)

I don't know if you want to move to clone to Workspace, but if you want to do so then do this:

while true do
noob = game.Workspace.Lighting.Noob:Clone()
noob.Parent = game.Workspace
noob.Position = Vector3.new(X, Y, Z)
wait(0.5)
end

^_^

0
Thanks! Code_Sensei 0 — 6y
Ad
Log in to vote
0
Answered by
dispeller 200 Moderation Voter
6 years ago

Hey there, you might want to set the parent of the clone so that way it doesn't just exist inside of nil and you can actually see it.

while true do
game.Workspace.Lighting.Noob:Clone().Parent = workspace
wait(0.5)
end

also, here is a little bit of a better way to do it:

while wait(.5) do
    workspace.Lighting.Noob:Clone().Parent = workspace
end

and if you have the noob inside of the Lighting, (just a reminder that Lighting exists under game and not workspace) you would do this:

while wait(.5) do
    game.Lighting.Noob:Clone().Parent = workspace
end

Happy scripting!

Answer this question