Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Part isn't a valid member of Workspace??

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

1 comment

0

Major issue in Capitalization and Misspelled words

3 answers

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

1 comment

0

o

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

This discussion is preserved as it was. New answers, comments, and votes are closed.