generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: How do I unanchor every brick inside of a model?

Previous Thread :: Next Thread 
Mario5422 is not online. Mario5422
Joined: 17 Nov 2008
Total Posts: 3922
12 Oct 2013 03:54 PM
Thanks
Report Abuse
IntellectualBeing is not online. IntellectualBeing
Joined: 29 Sep 2013
Total Posts: 701
12 Oct 2013 03:59 PM
In studio, open up explorer and properties. Then open up the model. Hold down shift or ctrl and select all the parts in the model. Look in the properties and uncheck anchored.
Report Abuse
Mario5422 is not online. Mario5422
Joined: 17 Nov 2008
Total Posts: 3922
12 Oct 2013 04:01 PM
oops, should have clarified better. I want to make a script where after touching a brick, all parts in a model are unanchored without changing them one by one.
Report Abuse
nicklas3689 is not online. nicklas3689
Joined: 26 Oct 2010
Total Posts: 676
12 Oct 2013 04:26 PM
game.workspace.model.Anchored= False
Report Abuse
Deadzonepred is not online. Deadzonepred
Joined: 30 Apr 2013
Total Posts: 51
12 Oct 2013 04:29 PM
Nicklas.. e.e

model = game.Workspace.MODELNAMEHERE

function unanchor()
for i, v in pairs do
v.Anchored = false
end

--some connectnig function here to connect unanchor() and being touched
:D
Report Abuse
Mario5422 is not online. Mario5422
Joined: 17 Nov 2008
Total Posts: 3922
12 Oct 2013 05:04 PM
deadzonepred,

I'm not sure exactly how to tie that in so that it happens on touch... this is what I have (I know it's wrong)

_______________
function onTouched(part)

model = game.Workspace.walkway

function unanchor()
for i, v in pairs do
v.Anchored = false
end

end
script.Parent.Touched:connect(onTouched)
Report Abuse
GGGGG14 is not online. GGGGG14
Joined: 29 Jan 2012
Total Posts: 25344
12 Oct 2013 05:18 PM
m = game.Workspace.Model:GetChildren()
for i = 1, #m do if
m.ClassName == "Part" then
m.Anchored = false
end
end
Report Abuse
Mario5422 is not online. Mario5422
Joined: 17 Nov 2008
Total Posts: 3922
12 Oct 2013 05:29 PM
@above

Ok, this is what I have:
-----------
function onTouched(part)

m = game.Workspace.walkway:GetChildren()
for i = 1, #m do if
m.ClassName == "Part" then
m.Anchored = false
end
end

end
script.Parent.Touched:connect(onTouched)
-----------

but for some reason, the model is being unanchored without me even touching the brick?
Report Abuse
Bebee2 is not online. Bebee2
Joined: 17 May 2009
Total Posts: 3985
12 Oct 2013 05:33 PM
debounce = false
script.Parent.Touched:connect(function(part)
if game.Players:GetPlayerFromCharacter(part.Parent) and not debounce then
debounce = true
for _,v in pairs(game.Workspace.walkway:GetChildren()) do
if v:IsA'BasePart' then
m.Anchored = false
end
end
end
end)

-- Try that now.
Report Abuse
smiley599 is not online. smiley599
Joined: 23 Jan 2010
Total Posts: 21869
12 Oct 2013 05:34 PM
:
-----------
function onTouched(part)
if part.Parent:findFirstChild("Humanoid") then
m = game.Workspace.walkway:GetChildren()
for i = 1, #m do if
m.ClassName == "Part" then
m.Anchored = false
end
end
end
end
script.Parent.Touched:connect(onTouched)
-----------
Report Abuse
smiley599 is not online. smiley599
Joined: 23 Jan 2010
Total Posts: 21869
12 Oct 2013 05:36 PM
Bee, a lot of that is very unnecessary.

By the way, only copy and paste what is between the ------ with mine, ignore the :, it's a typo.
Report Abuse
Mario5422 is not online. Mario5422
Joined: 17 Nov 2008
Total Posts: 3922
12 Oct 2013 05:40 PM
Ok, I am so confused. Everyone's scripts work, but they all unanchor the bricks before I even touch the brick that is supposed to trigger it.
Report Abuse
Bebee2 is not online. Bebee2
Joined: 17 May 2009
Total Posts: 3985
12 Oct 2013 05:46 PM
@Mario5422,
A. Either you forgot to unanchor the parts

or

B. Use the latter scripts shown.

btw

"m.ClassName == "Part" then"

You mean m[i][.ClassName == "Part"... right?
Report Abuse
smiley599 is not online. smiley599
Joined: 23 Jan 2010
Total Posts: 21869
12 Oct 2013 05:49 PM
You're right, but it ain't my fault (in a way); I just copied Ggggg's script and added the if statement to avoid it being called by a non player.
Report Abuse
Mario5422 is not online. Mario5422
Joined: 17 Nov 2008
Total Posts: 3922
12 Oct 2013 06:00 PM
ok, I'm embarrassed, the parts in the model were already unanchored.

but after anchoring them all, none of the scripts are working when I touch the trigger brick.
Report Abuse
lampwnage121 is not online. lampwnage121
Joined: 20 Oct 2012
Total Posts: 4285
12 Oct 2013 06:01 PM
@bebee
"if v:IsA'BasePart' then
m.Anchored = false"
Le v
Le m
Report Abuse
Bebee2 is not online. Bebee2
Joined: 17 May 2009
Total Posts: 3985
12 Oct 2013 06:02 PM
debounce = false
script.Parent.Touched:connect(function(part)
if game.Players:GetPlayerFromCharacter(part.Parent) and not debounce then
debounce = true
for _,v in pairs(game.Workspace.walkway:GetChildren()) do
if v:IsA'BasePart' then
v.Anchored = false
end
end
end
end)

-- I always make those small mistakes.

Report Abuse
Mario5422 is not online. Mario5422
Joined: 17 Nov 2008
Total Posts: 3922
12 Oct 2013 06:04 PM
@bebee

Yay, that works!! :D Thanks!
Report Abuse
stephen1182 is not online. stephen1182
Joined: 31 Aug 2010
Total Posts: 4003
12 Oct 2013 06:35 PM
for i,v in pairs(model:children()) do
ypcall(function() v.Anchored=true end)
end
Report Abuse
stephen77 is not online. stephen77
Joined: 18 Dec 2008
Total Posts: 49
12 Oct 2013 06:45 PM
@stephen1182, Hes asking for an unanchor...
for i,v in pairs(model:children()) do
pcall(function() v.Anchored=false; end);
end
Report Abuse
stephen1182 is not online. stephen1182
Joined: 31 Aug 2010
Total Posts: 4003
12 Oct 2013 06:46 PM
Whoops XD
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image