local player = game.Players.LocalPlayer
local click = game.Workspace.Map.LockedDoors.Lock.Locked:WaitForChild("Cube").ClickDetector
local function unanchorAllChildren()
local lockModel = workspace.Map.LockedDoors:FindFirstChild("Lock")
if lockModel then
local modelsToCheck = {"Locked", "Chain"}
for _, modelName in ipairs(modelsToCheck) do
local model = lockModel:FindFirstChild(modelName)
if model then
for _, child in model:GetDescendants() do
if child:IsA("MeshPart") then
child.Anchored = false
end
end
else
warn(modelName .. " model not found in Lock")
end
end
else
warn("Lock model not found in LockedDoors")
end
end
if click then
click.MouseClick:Connect(function()
local key = player.Backpack:FindFirstChild("Key100M")
if key then
unanchorAllChildren()
end
end)
end
#im trying to make it unanchor all the parts inside of the model but its not working
1 messages · Page 1 of 1 (latest)
model:GetDescendants() should be model:GetChildren() I think that should resolve your issue
i tried that and then tried descendants but it dosnt work
are you trying to unanchor the character model or a door?
im trying to unanchor the lock and the chain so it falls down
is the entire model not unanchoring or only parts
no
can I see the hierarchy for the model
yeah
if lockModel then
local locked = Lock:FindFirstChild("Locked"):GetChildren -- Gets children of locked model
local chain = Lock:FindFirstChild("Chain"):GetChildren -- Gets children of chain model
locked.Anchored = false -- Unanchores
chain.Anchored = false -- Unahchores
else
warn(modelName .. " model not found in Lock")
end
this should work but there might be something that doesn't..
lmk : )
@flat warren
okay lemme test this out man tysm
don't thank me yet, gotta see if it works
does that resolve? or still there
cant you not use : after ()?
lemme test this
um, ok :GetChildren should have () after mb
but um, I'm trying a simpler version and it's not unanchoring so we've come full circle Dx
nah this aint done till I get this 🙏
no that shouldnt be an issue
the issue is it can't locate the "anchored" from the list of parts but it should be able to cuz there's no error
ik i was trying to figure out this problem for days
this is not complete code, and bigger than just forgetting (), you're trying to set .anchored on a table instead of any parts. getchildren gives a table of parts. wut u doin
shut your squiggle diggle I got it
local mainModel = workspace.MainModel
if mainModel then
local mainModelChildren = mainModel:FindFirstChild("Model"):GetChildren()
print(mainModelChildren)
for i, ChildrenCount in ipairs(mainModelChildren) do
ChildrenCount.Anchored = false -- finds the anchored property in the tabled parts and sets it to false
end
end
you'll have to rename stuff to make it work for your script @flat warren but this does work
disabling .anchored on a networked part doesn't seem to awaken its physics object, probably because most of the time they belong to the server. basically, do the unanchoring on the server otherwise it'll behave in weird ways
the code is for a door that shouldn't be accessed by everyone if they don't have the key. It's purely cosmetic when it unanchors
** You are now Level 4! **
and by weird, i mean weird like this. this is just a truss i unanchored on the client and pushed it over, but its anchored on the server.
looks fine to me
I think he wants the door to unanchor and fall through the floor so this wouldn't be an issue either way
yea it didnt work
What are you even tryan do?
is it on a localscript or script
unanchor all the parts inside of a model
i dont want it to be a server script because i want it to be only seen by the person that unlocks it
local model = game.Workspace.ModelName
for _, d in pairs(mode:GetDescendants()) do
if d:IsA("BasePart") then
d.Anchored = false
end
end
this is the most simplest script to unanchor every parts on a model
only need to check isa basepart
it captures parts, unions, and meshparts on its own
ah fair enough
@raven wagon how long have you been coding on studio
mb I did not mean to ping the other guy
over a year at this point, roblox only
many more years on other projects
zamn. I'mma be just like you, geeking out over roblox code!! (give me a few months)
roblox code sucks i have to make my own replication system
coz roblox doesn't have one that can do prediction properly
wym replication system
the thing that keeps server and clients all in sync and seeing the same world at the same time
ooh yeah that is so ass
is it a ping problem? ik other games generally peak at 25-30 ping while roblox averages 60-150
it's not just ping but yes ping mostly
yeah I can see why you'd want to script your own Dx
My internet is literally so shit it makes me wanna kill myself
I can’t load Roblox studio I gotta type on discord on my phone
oh it's so over for you 💀
nah it applies to pve too, see studio has 0 ping. the latency you're seeing is actually physics replication, which is intentionally delayed by about 50ms, have to account for that too
ummm.. are you sure?
yes
I think studio has ping
pretty sure that number includes the physics replication delay
if you do player:getnetworkping() in studio it returns 0
coz there is no ping
that makes sense then
this isn't even my thread 😭
do yall know how to fix this 23:22:24.024 Cube is not a valid member of Model "Workspace.Map.LockedDoors.Lock.Locked" - Client - LocalScript:2
my cube is part of thelocked model
waitforchild
@full carbon this didnt work idk whats going on ```
local click = game.Workspace.Map.LockedDoors.Lock.Locked:WaitForChild("Cube").ClickDetector
click.MouseClick:Connect(function()
local lockmodel = game.Workspace.Map.LockedDoors.Lock.Chain
for _, d in pairs(lockmodel:GetDescendants()) do
if d:IsA("Part") or d:IsA("MeshPart") then
d.Anchored = false
end
end
end)```
thank you
whats the syntax error?
i never expected someone else to have a similar name to me either dw 😭
Lurking 🥀
should i use a remote event to do the unanchoring @everyone
are u deadass?
Yea
who tf do you think you are
