I've been trying to create a growing 'nuke' using a simple sphere that will call breakjoints on any object it hits (right now it only does this with players, I haven't updated it yet.. I need to solve this problem first). I've been having trouble with it however, because due to the touched event whenever a player walks into it or touches it, while growing it will fly up above the players head. is there any solution to this problem? I've thought of working with the bricks position or something, but that's a bit difficult to do and I'm sure there is a more simple solution.
(in the actual code the first bit comes later on, I just pulled these two out of the larger script)
for i = 0.2, 1000, 3 do script.Parent.Size = Vector3.new(i, 0, i) wait(0.1) end end end end) script.Parent.Touched:connect(function(hit) if script.Parent.Transparency == 1 then return end if hit.Parent:FindFirstChild("Humanoid") then hit.Parent:BreakJoints() end end )
You are going to have to reposition the sphere by changing it's CFrame property each time you adjust the size. Luckily this is quite easy, as we only need to set it's CFrame to a constant value each time you adjust the size.
local sphere = script.Parent local cframe = sphere.CFrame for i = 0.2, 1000, 3 do sphere.Size = Vector3.new(i, i, i) sphere.CFrame = cframe end