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

How Do I Make Instance Stay In Place and Go Throught Blocks?

Asked by 9 years ago

Hey, I am making a mini nuke that explodes when you touch part. It works, but when it expands, it always keeps touching the top of the baseplate and doesn't go through the baseplate. How can I stop this from happening? Here is my script:

01notBeenTouched = true
02wait(4)
03function onTouch(hit)
04    HumanoidIsTrue = hit.Parent:FindFirstChild("Humanoid")
05    if notBeenTouched and HumanoidIsTrue then  
06    notBeenTouched = false 
07    NukeBall = Instance.new("Part", Workspace)
08    function onBombTouch(Hit)
09    Hit:BreakJoints()
10end
11    NukeBall.Touched:connect(onBombTouch)      
12    NukeBall.Shape = "Ball"
13    NukeBall.BrickColor = BrickColor.new("Deep orange")
14    NukeBall.CanCollide = false
15    notBeenTouched = false 
View all 31 lines...

1 answer

Log in to vote
0
Answered by 9 years ago

When a part is resized, it works the same as trying to change the position of a part into another part instead of using CFrame, this causes it to move to the very top of the parts on-contact. Now, how do we solve this problem? We must continuously put the - In this case - NukeBall CFramed into a position. It seems that you want the NukeBall at position (0,0,0). So, we fix this by instead of doing NukeBall.Position = Vector3.new(0,0,0), we use CFrame which ignores collision, NukeBall.CFrame = CFrame.new(0,0,0).

Finished Code Bellow, Please toss a Plus 1 rep and accept this answer if this helps and comment any questions or problems to this answer! :

01notBeenTouched = true
02wait(4)
03function onTouch(hit)
04    HumanoidIsTrue = hit.Parent:FindFirstChild("Humanoid")
05    if notBeenTouched and HumanoidIsTrue then  
06    notBeenTouched = false 
07    NukeBall = Instance.new("Part", Workspace)
08    function onBombTouch(Hit)
09    Hit:BreakJoints()
10end
11    NukeBall.Touched:connect(onBombTouch)      
12    NukeBall.Shape = "Ball"
13    NukeBall.BrickColor = BrickColor.new("Deep orange")
14    NukeBall.CanCollide = false
15    notBeenTouched = false 
View all 32 lines...
0
Hey, thanks for answering! I don't have enough reputation to give you +1, but when I do I will :) yoman1776 85 — 9y
0
Okay, and no problems that's why I'm here. (To help/get rep <3) alphawolvess 1784 — 9y
Ad

Answer this question