Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 4 years ago

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

Log in to vote
0
Answered by
Geobloxia 251 Moderation Voter
4 years ago
Edited 4 years ago

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)
Ad
Log in to vote
0
Answered by 4 years ago

Part.Anchored = true

0
thank. i tried a script with Part.Anchored and it didnt work but i guess that is the right way zachmcfly 11 — 4y
Log in to vote
0
Answered by 4 years ago

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)
0
This isn't the most efficient way because the baseplate or other inanimate objects can activate the function. Geobloxia 251 — 4y

Answer this question