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

Script not working after updates. anyways to update it to make it work?

Asked by 5 years ago

here is it:

while true do workspace.stick:remove() game.Lighting.stick1:Clone().Parent = game.Workspace wait(10) workspace.stick1:remove() g game.Lighting.stick:Clone().Parent = game.Workspace

wait(10)
workspace.stick2:remove()
game.Lighting.stick3:Clone().Parent = game.Workspace
wait(10)
workspace.stick3:remove()
game.Lighting.stick4:Clone().Parent = game.Workspace
wait(10)

end

1
Remove() is deprecated, which means don't use it anymore. Use Destroy() instead. Pojoto 329 — 5y
0
Also you're being inconsistent when referencing the game's workspace; sometimes you use workspace and other times the more verbose game.Workspace. While it doesn't affect the output of the code, consistency is always imperative for readable and non-headache-inducing code. Please change that in future projects. thebayou 441 — 5y
0
You also should NOT be using Lighting as storage. You should be using ServerStorage or ReplicatedStorage. This isn't 2008. It makes NO sense using a service meant for handling the environmental lighting of the game, as storage. User#19524 175 — 5y
0
what do you see in output the8bitdude11 358 — 5y

1 answer

Log in to vote
0
Answered by
Axdrei 107
5 years ago

Hello imagine!

I will tell you some things about your script. Firstly, remove is DEPRECATED, instead you should use destroy function. Second, you are using lighting as storage which is bad, never use Lighting for storage when you have ReplicatedStorage, ServerStorage. This script is poorly made and I will show you a way to make it work with "for i loop".

Here's a tricky way with loops :)

local Lighting = game:GetService("Lighting")
for i = 1, 3 do
    local Stick = workspace:FindFirstChild("stick"..i)
    local SecondStick = Lighting:FindFirstChild("stick"..i+1)
    if Stick and SecondStick then
        Stick:Destroy()
        SecondStick:Clone().Parent = workspace
    end
    wait(10)
end
Ad

Answer this question