In my game, I have a building system that welds blocks together. Well, I want to detect all of the blocks that get disconnected (basically, blocks that are moving because they are falling over).
Now doing part:GetPropertyChangedSignal(“Position”) just doesn’t work at all for me, and I have no idea why. Part.Changed works, but it’s still not accurate. If I make a tower of 10 blocks and destroy the bottom part, it’d only pick up about 3 movements.
Now trying to set the network ownership of a block to the server that’s still connected (basically an anchored part) throws an error saying I can’t set the network owner of a part that’s anchored to the server, so how exactly does Roblox do it?
Dede_4242
(Dede_4242)
March 23, 2023, 3:06am
#2
I’m not really sure what you’re trying to do, but something like:
part:GetPropertyChangedSignal(“Anchored”):Connect(function()
if anchored then
print(“Anchored”)
else
print(“Unanchored”)
end
end
See if that works (I’m thinking you already have a system to automatically unanchor parts in this case)
1 Like
They’re being welded, not anchored.
Dede_4242
(Dede_4242)
March 23, 2023, 3:23am
#4
But they’re being welded to an Anchored part? Right?
I think that you would do something like;
if weld.Part0 == mainPart then
print(“welded”
else
print(“not welded”)
end
Fizzitix
(69Goat)
March 23, 2023, 3:25am
#5
You can achieve this using .ChildRemoved
. (documentation )
Example:
local block = -- Path to block
block.ChildRemoved:Connect(function(removed)
if removed.ClassName == "Weld" then
print("Weld was removed")
end
end)
Or, if the weld is a Descendant of the block, you can use .DescendantRemoved
instead.
(My apologies if this isn’t what you’re looking for, the title and content of this post was a little confusing for me)
When a welded part becomes unanchored due to a weld breaking this means that the assembly is changing from 1 assembly into 2.
When the assembly changes the root part changes.
This is not possible to detect due to the performance reason below:
This is a bit unfortunate but is the intended behavior for performance reasons.
Allowing the physics engine to freely reshuffle the spanning tree (the thing the part is an assembly root of) whenever it wants and not have to go back and contact the DataModel about the changes provides a large performance benefit. Basically, it’s similar to the reasoning for you not getting CFrame changed events when parts are being moved thanks to physics simulation.
If you want a predictable root for game logi…
Consequently you can only detect the weld breaking or block being removed instead. To rephrase it detect the cause rather than the symptom.
Then I guess do something with the parts :GetConnectedParts to detect the unconmected and the connected.
1 Like
I’m feel like I’m getting closer to resolving the issue with :GetConnectedParts but there’s no way to listen to it.
tnavarts
(tnavarts)
March 23, 2023, 7:35am
#8
:IsGrounded() may be helpful here. (The “ground” = anything anchored)
2 Likes
system
(system)
Closed
April 6, 2023, 5:11pm
#10
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.