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

Global 'up', 'Uro' is only used in the enclosing function 'Explode'; consider changing it to local?

Asked by 2 years ago

local Rep = game:WaitForChild("ReplicatedStorage") local remote = Rep:WaitForChild("explode")

remote.OnServerEvent:Connect(function(player) local character = player.Character local RootPart = character:WaitForChild("HumanoidRootPart") local folder = workspace:FindFirstChild("DebrisFolder") or Instance.new("Folder",workspace) folder.Name = "DebrisFolder"

local position = Instance.new("BodyVelocity",RootPart)
position.MaxForce = Vector3.new(9999999999999, 9999999999999, 9999999999999)
position.P = 300
position.Velocity = RootPart.CFrame.LookVector * .1
game.Debris:AddItem(position,2)

local val = -4
local sizez = 3
local sizex = 10
local sideval = .5




local function Explode()
    local extra = math.random(-11,11)/10
    local fire = game.ReplicatedStorage:WaitForChild("Explosion"):Clone()
    local side = math.random(-sideval,sideval)
    up = fire.Size.Y/2
    local rotate = math.random(0,180)

    local MRo = math.random(99,100)
    if MRo == 99 then
        local SRo = math.random(8,10)/10
        URo = MRo + SRo 
    else
        local SRo = math.random(1,3)/10
        URo = MRo + SRo 
    end

    fire.Size = Vector3.new(sizez,sizex,sizez)
    fire.CFrame = RootPart.CFrame * CFrame.new(side,-up,val + extra)
    fire.Parent = folder
    fire.CFrame = fire.CFrame * CFrame.fromEulerAnglesXYZ(side,-up, val + extra)


    val = val - 2
    sizez = sizez + 1
    sizex = sizex + 1
    sideval = sideval + .5
    game.Debris:AddItem(fire,5)


    spawn(function()
        wait(.5)
        local tween = game:GetService("TweenService")

        local info = TweenInfo.new(
            .3,
            Enum.EasingStyle.Sine,
            Enum.EasingDirection.Out,
            0,
            false,
            0
            )

        local properties = {
            CFrame = fire.CFrame * CFrame.new(0,up * 1.5, 0)
            }

        local Tween = tween:Create(fire,info,properties)
        Tween:Play()

    end)










end

for i = 1,50 do
    Explode()
    wait()


end

end)

1 answer

Log in to vote
1
Answered by
Puppynniko 1059 Moderation Voter
2 years ago

on the top of your script add

local uro = nil
local up = nil
Ad

Answer this question