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

Why do spheres stack?

Asked by 8 years ago

trying to sb and i tried to make a sphere that kills people a little but they stack everything works they just stack and i dont know how to fix

local plr = game.Players.LocalPlayer
local mouse = plr:GetMouse()
local chr = plr.Character or plr.CharacterAdded:wait()

local part = Instance.new("Part")
part.Size = Vector3.new(1,1,1)
part.CanCollide = false
part.BrickColor = BrickColor.White()
part.Anchored = true
part.FormFactor = "Custom"
part.BottomSurface = "Smooth"
part.TopSurface = "Smooth"

local mesh = Instance.new("SpecialMesh",part)
mesh.MeshType = "Sphere"

debounce = false

mouse.KeyDown:connect(function(key)
    if key == 'z' or key == 'x' then
        local clone = part:Clone()
            clone.Parent = chr
            if key == 'x' then
                clone.BrickColor = BrickColor.Blue()
            end
            clone.Touched:connect(function(p)
            local h = p.Parent:FindFirstChild("Humanoid")
            if h and h.Parent.Name ~= 'supercoolguy53' then
                if key == 'z' then
                    debounce = true
                    local damage = h.MaxHealth/20
                    h.Health = h.Health - damage
                elseif key == 'x' and debounce == false then
                    debounce = true
                    local freeze = part:Clone()
                    freeze.Parent = h.Parent
                    freeze.Size = Vector3.new(7,7,7)
                    h.Parent.Torso.Anchored = true
                    wait(5)
                    h.Parent.Torso.Anchored = false
                    freeze:Destroy()
                    debounce = false
                end
            end
        end)
        for i = 1,100 do
            if i == 100 then
                wait(1)
                for i = 1,100 do
                    game:GetService('RunService').RenderStepped:wait()
                    clone.Size = clone.Size - Vector3.new(.2,.2,.2)
                end
                clone:Destroy()
            end
            game:GetService('RunService').RenderStepped:wait()
            clone.CFrame = chr.Torso.CFrame
            clone.Size = clone.Size + Vector3.new(.2,.2,.2)
        end
    end
end)

they stack ontop of my head and ontop of each other.

Answer this question