So between the If and Then statements I want something like "If MapContents is in workspace then" and "If MapContentsSmooth is in workspace then" but im not sure how to write that
wait(1) function onClick() script.Parent.Sound:Play() wait(.1) if then game.Workspace.MapContents:Destroy() game.Lighting.MapContentsSmooth:clone().Parent = game.Workspace else if then game.Workspace.MapContentsSmooth:Destroy() game.Lighting.MapContents:clone().Parent = game.Workspace end end end script.Parent.ClickDetector.MouseClick:connect(onClick)
Hello, You know you could use "if workspace.Parent == "Place1(example)" then"or in some situations "if workspace.Parent.ClassName == "DataModel" then (example)".
Or you could use (as an example) if game:FindFirstChild("Workspace") which we will use now.
Or you could use if game.Workspace ~= nil (again, this is just an example)
In this situation it will look like this:
wait(1) function onClick() script.Parent.Sound:Play() wait(.1) if workspace:FindFirstChild("MapContents") then game.Workspace.MapContents:Destroy() game.Lighting.MapContentsSmooth:Clone().Parent = game.Workspace -- :clone is deprecated, recommended using :Clone else if workspace:FindFirstChild("MapContents") then game.Workspace.MapContentsSmooth:Destroy() game.Lighting.MapContents:Clone().Parent = game.Workspace -- :clone is deprecated, recommended using :Clone end end end script.Parent.ClickDetector.MouseClick:Connect(onClick) -- :connect is deprecated, recommended using :Connect