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

How would I prevent the brick from going around the block it is placed?

Asked by 7 years ago

The brick, "LightExplosion" is a ball part that is fired with a laser and then rapidly expands to its size. The issue is when it resizes it goes around blocks instead of cframing into them and it only happens with the onTouch function. When the function is removed it works fine. How would I fix the function to where it doesn't force the ball to go over the designated part and instead half into it? Here's the code causing the problem:

01-- Adds a repulsive force to anything this object touches
02 
03local Debris = game:GetService('Debris')
04 
05 
06local CharacterToIgnore = script:WaitForChild('CharacterToIgnore').Value
07 
08 
09 
10local MAGNITUDE = 3E4
11 
12local TIME_OF_FORCE = 0.2
13 
14 
15local Part = script.Parent
View all 84 lines...

Here's the code where the ball is actually created:

001local tool = script.Parent
002local player = game:GetService("Players").LocalPlayer
003 
004local beam = Instance.new("Part", workspace)
005 
006 
007tool.Equipped:connect(function(mouse)
008    print("Tool equipped!")
009    --wait(1)
010    mouse.Button1Down:connect(function()
011 
012        script.Disabled = true
013        script.Parent.Sound:Play()
014        print("READY A")
015        print("Mouse pressed!")
View all 110 lines...

Answer this question