01 | local Part = Instance.new( "Part" ) |
02 |
03 | Part.Position = Vector 3. new( 0 , 20 , 0 ) |
04 | Part.Parent = workspace |
05 |
06 | Part.Touched:Connect( function () |
07 | local RedPart = Instance.new( "Part" ) |
08 | RedPart.Position = Part.Position |
09 | Part:Destroy() |
10 | RedPart.Transparency = 1 |
11 | RedPart.Size = workspace.Part.Size |
12 | RedPart.Anchored = true |
13 |
14 | RedPart.Parent = workspace |
15 | RedPart:SubtractAsync(workspace.Baseplate) |
16 | end ) |
im trying to make a part that falls down the air and when it touches the baseplate it removes part of the baseplate
You destroyed part before you accessed it's size. Change your code to this:
01 | local Part = Instance.new( "Part" ) |
02 |
03 | Part.Position = Vector 3. new( 0 , 20 , 0 ) |
04 | Part.Parent = workspace |
05 |
06 | Part.Touched:Connect( function () |
07 | local RedPart = Instance.new( "Part" ) |
08 | RedPart.Position = Part.Position |
09 | RedPart.Transparency = 1 |
10 | RedPart.Size = workspace.Part.Size |
11 | Part:Destroy() |
12 | RedPart.Anchored = true |
13 |
14 | RedPart.Parent = workspace |
15 | RedPart:SubtractAsync(workspace.Baseplate) |
16 | end ) |
That should work
i fixed my problem it was because on line 15 it was
1 | RedPart:SubtractAsync(workspace.Baseplate) |
instead of
1 | RedPart:SubtractAsync( { workspace.Baseplate } ) |
tho your code didnt fix my issue but thanks anyways