I am trying to make a script that checks if something is anchored or not

You can write your topic however you want, but you need to answer these questions:

  1. I want to make a script that checks a part if it is anchored or not and if it is unanchored a clone of the object gets put in the workspace. Keep it simple and clear!

  2. There is no error message in the output but it doesn’t put the clone in the workspace. Include screenshots / videos if possible!

  3. I have tried looking for solutions on the internet. Did you look for solutions on the Developer Hub?

-- put this into the part
if not script.Parent.Anchored then
local clone = script.Parent:Clone()
clone.Parent = workspace
end

I am still having the same problems with this script.

Is the script inside of the part? What type of script did you put?

A quick solution is just:

if Part.Anchored == true then —do stuff elseif Part.Anchored == false then —do stuff end

The script is inside of the part and I used a normal script.

Can you show the error? (Show an image)

There isn’t any output error that is why I said “the same problems as before”

Is the part the script is inside of anchored or not?

The script I put the part inside of is anchored, however when you click it, it becomes unanchored.

This script is not working either.

Ah, the script actually checks if the part is even anchored at first. This script should work.

script.Parent.Changed:Connect(function()
if not script.Parent.Anchored then
local clone = script.Parent:Clone()
clone.Parent = workspace
else return;
end
end)
1 Like

Put this script inside of the part that needs to be checked:

script.Parent:GetPropertyChangedSignal("Anchored"):Connect(function()
	if script.Parent.Anchored == false then
		local Clone = script.Parent
		Clone.Parent = workspace
	end
end)