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

Can I clone a part when something is non-existent/nil?

Asked by 6 years ago

I've been trying to spawn this part when the part is non-existent, but it just results in an output error. So, I was wondering how, or if I can.

if game.Workspace.part == nil then
    print("part spawned")
    game.ServerStorage.part:Clone().Parent = workspace
end
0
`if not Workspace:FindFirstChild('part') then` TheeDeathCaster 2368 — 6y
0
put the part somewhere where it can't be seen instead, like Lighting. If the parent is nil, it can't be found unless it was defined before the parent was set to nil. ax_gold 360 — 6y
0
^ That's false information; the Lighting service can be seen by the server **and** the client. His choice of using the ServerStorage service was right. http://wiki.roblox.com/index.php?title=API:Class/ServerStorage TheeDeathCaster 2368 — 6y
0
^ It even clearly states on the wiki that ServerStorage and ReplicatedStorage should be used over the Lighting service when it comes to holding scripts, models, etc. http://wiki.roblox.com/index.php?title=API:Class/Lighting TheeDeathCaster 2368 — 6y

Answer this question