I am a new scripter and I wanna try this out and it seems to not find part in workspace
local part = game.worksapce local part2 = part.Part2 if part.parent == game.workspace then part2:Clone().parent = part end
any help is appreciated
Please be sure when getting a game's service, such as workspace, it's recommended by me that you use game:GetService("Service Name") to do it. This is so that you avoid any issues with services being renamed or configured in an inaccessibly way.
Here's a little rewrite in return.
local Workspace = game:GetService("Workspace") local Part2 = Workspace:FindFirstChild("Part2") -- Use this if you're waiting for the part: Workspace:WaitForChild("Part2") if Part2.Parent == Workspace then Part2:Clone().Parent = Workspace end
Alright so there are a few problems in your script going with capitalization and misspelled Words
Heres your current script
local part = game.worksapce--Workspace is misspelled and the W should be capitalized local part2 = part.Part2 if part.parent == game.workspace then -- Workspace should be capitalized and Parent aswell part2:Clone().parent = part --Parent should be capitalized aswell end
I wont redo the code for you or else that would be doing it for you I hope this helps accept if it does
Look i fixed it, your errors were capitalization. Try this one!
local part2 = game.Workspace:FindFirstChild("Part2") -- or :WaitForChild("Part2") if part.Parent == game.Workspace then part2:Clone().Parent = game.Workspace end
Also set the position because it's gonna clone anywhere! Hope this helps, and have fun learning! :D