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

Anchoring in scripts. I dont know how to. Part.Anchored?

ok so, im looking to make a script that has if you touch the brick, it will unanchor and fall over.

i am very new to scripting :( so i dont know how to unanchor with scripts.

3 answers

✓ Accepted answer

Someone kind of beat me to this. But this script is different:

local Part = script.Parent -- defining the part
Part.Touched:Connect(function(hit) -- Function activates when being touched.
-- hit is the thing that touched the part
	if game.Players:GetPlayerFromCharacter(hit.Parent) then
		-- Checks to see if player touched the part
		Part.Anchored = false -- sets Boolean value of anchored of part
		-- to false
	end
end)

Part.Anchored = true

1 comment

0

thank. i tried a script with Part.Anchored and it didnt work but i guess that is the right way

Create a Script and place it inside the part, then write this code inside. I also recommend reading the Wiki page about Anchoring Parts, and Properties in general.

local Part = script.Parent -- Referencing the part
Part.Touched:Connect(function() -- When the part is Touched then
	Part.Anchored = false -- Set the Part's anchored property to false
end)

1 comment

0

This isn't the most efficient way because the baseplate or other inanimate objects can activate the function.

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