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

Can someone proof-read my code for Voidacity Script Builder?

Asked by
Mr_Unlucky 1085 Moderation Voter
5 years ago

I've been scripting a script for Voidacity Script Builder, and I want to see if there are any bugs/misakes I have missed during the code.

--[[ 
    Script by Mr_Unlucky
    Hello, to those who found this script, please dont remove the credits, and please dont leak.
    CONTROLS;
    [Z]; Brimstone Barrage
    [X]; Soul Strike
    [C]; Blaze Beam
--]]
--//=================================\\
--||          -=CONTROLS=-           ||
--\\=================================//
print("Script by Mr_Unlucky")
print("Hello, to those who found this script, please dont remove the credits.")
print("CONTROLS;")
print("[Z]; Brimstone Barrage")
print("[X]; Soul Strike")
print("[C]; Blaze Beam")
print("CREDITS")
print("SezHu - For the hat weld script. It wasn't copied and pasted, It was actually typed manually.")
print("Mr_Unlucky(me) - Scripted this.")
wait(0.1)
--//=================================\\
--||         -=VARIABLES=-           ||
--\\=================================//
--//MISCELLANEOUS\\--
Attacking = false -- These were implemented as a safety precaution so no one just uses all the moves at once.
BrimstoneBarrage = false
SoulStrike = false
BlazeBeam = false
Running = false
Hostile = false
CurrentTitle = "Demonic Entity"
--//PLAYER\\--
local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer
local Character = LocalPlayer.Character
local Humanoid = Character.Humanoid
local RightArm = Character["Right Arm"]
local LeftArm = Character["Left Arm"]
local RightLeg = Character["Right Leg"]
local LeftLeg = Character["Left Leg"]
local Torso = Character["Torso"]
local Head = Character["Head"]
local RootPart = Character["HumanoidRootPart"]
local Mouse = LocalPlayer:GetMouse()
--//=================================\\
--||     -=PLAYER CUSTOMIZATION=-    ||
--\\=================================//
--//AVATAR\\--
Humanoid.MaxHealth = "inf"
Humanoid.Health = "inf"
Humanoid.WalkSpeed = 110
Humanoid.JumpPower = 90
Character.Shirt:Remove()
Character.Pants:Remove()
local newShirt = Instance.new("Shirt",Character)
local newPants = Instance.new("Pants",Character)
newShirt.Name = "Shirt"
newPants.Name = "Pants"
newShirt.ShirtTemplate = "http://www.roblox.com/asset/?id=1013516988"
newPants.PantsTemplate = "http://www.roblox.com/asset/?id=1035284728"
HatHandle = Instance.new("Part")
HatMesh = Instance.new("SpecialMesh")
HatWeld = Instance.new("Weld")
HatHandle.Parent = Character
HatHandle.Name = "Handle"
HatHandle.CanCollide = false
HatHandle.Locked = true
HatHandle.Size = Vector3.new(1.93, 1.77, 1.6)
HatMesh.Parent = HatHandle
HatWeld.Part0 = Head
HatWeld.Part1 = HatHandle
HatWeld.C0 = CFrame.new(0,.4,0) * CFrame.fromEulerAnglesXYZ(math.rad(-1),0,0)VertexColor = Vector3.new(1,1,1)
HatHandle.Transparency = 0
HatMesh.MeshId = "http://www.roblox.com/asset/?id=62246019"
HatMesh.TextureId = "http://www.roblox.com/asset/?id=62246077" 
Head.face.Texture = "http://www.roblox.com/asset/?id=470245396"
for i,v in pairs (Character:GetChildren()) do
    if v.ClassName == "Hat" or "Accessory" then
        v:Destroy()
    end
end
--//TITLE\\--
local BillBoard = Instance.new("BillboardGui",Head)
local Title = Instance.new("TextLabel",BillBoard)
BillBoard.AlwaysOnTop = true
Title.Text = CurrentTitle
Title.Font = "Bodoni"
Title.TextColor3 = Color3.fromRGB(0,0,0)
Title.TextStrokeColor3 = Color3.fromRGB(255,0,0)
Title.TextStrokeTransparency = 0
Title.BackgroundTransparency = 1
Title.Size = UDim2.new(0,200,0,50)
Title.TextScaled = true
--//=================================\\
--||      -=ABILITIES/ATTACKS=-      ||
--\\=================================//
function AttackDetection(Key)-- Detects a key input for attack
    if Key == "z" and Attacking == false then
        Brimstone()
    if Key == "x" and Attacking == false then
        Soul()
    if Key == "c" and Attacking == false then
        Blaze()
    else
        print("You are already attacking/You're pressing on the wrong key")
    end     
    end
    end
end

function Brimstone()
    print("Activating Brimstone Barrage")
    CurrentTitle = "Face the fury of brimstone!"
    Title.Text = CurrentTitle
    local MeteorCount = math.random(5,10)
    for i = MeteorCount, 1 do
        local Part = Instance.new("Part")
        local Mesh = Instance.new("SpecialMesh")
        Part.Size = Vector3.new(8,8,8)
        Part.Transparency = 1
        Part.Anchored = false
        Mesh.Parent = Part
        Mesh.Scale = Vector3.new(5,5,5)
        local PartX = math.random(Torso.CFrame.x-30,30)
        local PartZ = math.random(Torso.CFrame.z-30,30)
        Part.Position = CFrame.new(PartX,Torso.CFrame.Y+30,PartZ)
        local Fire = Instance.new("Fire",Part)
        Fire.Size = 100
        Fire.Heat = 20
        function onTouch(part)
        local humanoid = part.Parent:FindFirstChild("Humanoid")
        if (humanoid ~= nil) then
            humanoid.Health = 0
         Part.Touched:connect(onTouch)
    wait(0.4)
    CurrentTitle = "Demonic Entity"
    Title.Text = CurrentTitle
        end
    end
    end
    end

function Soul()
    print("Activating Soul Strike")
    CurrentTitle = "With the power of a thousand souls, attack!"
    Title.Text = CurrentTitle
    local Soul = Instance.new("Part")
    Soul.Transparency = 0.3
    Soul.Material = "Neon"
    Soul.Anchored = true
    Soul.Rotation = Vector3.new(0,0,90)
    Soul.Color = Color3.fromRGB()(255,255,255)
    Soul.Size = Vector3.new(38.59, 4.32, 9.58)
    Soul.Shape = "Cylinder"
    Soul:SetPrimaryPartCFrame(CFrame.new(Mouse.hit))
    function onTouch(part)
        local humanoid = part.Parent:FindFirstChild("Humanoid")
        if (humanoid ~= nil) then
            humanoid.Health = 0
    Soul.Touched:connect(onTouch)
    wait(0.5)
    Soul:Destroy()
    CurrentTitle = "Demonic Entity"
    Title.Text = CurrentTitle   
    end
        end
end

function Blaze()
    print("Activating Blaze Beam")
    CurrentTitle = "Feel the pain the sun's concentrated heat!"
    Title.Text = CurrentTitle
    local Blaze = Instance.new("Part")
    Blaze.Shape = "Cylinder"
    Blaze.Transparency = 0.35
    Blaze.Color = Color3.fromRGB(255,0,0)
    Blaze.CFrame = Torso.CFrame * CFrame.new(0, 0, -2)
    function onTouch(part)
        local humanoid = part.Parent:FindFirstChild("Humanoid")
        if (humanoid ~= nil) then
            humanoid.Health = 0
    Blaze.Touched:connect(onTouch)
    wait(0.5)
    Blaze:Destroy()
    CurrentTitle = "Demonic Entity"
    Title.Text = CurrentTitle
end
end
end
--//=================================\\
--||        -=USER INTERFACE=-       ||
--\\=================================//
local ScreenGui = Instance.new("ScreenGui",LocalPlayer.PlayerGui)
local BrimstoneFrame = Instance.new("Frame",ScreenGui)
local SoulFrame = Instance.new("Frame",ScreenGui)
local BlazeFrame = Instance.new("Frame",ScreenGui)
local BrimstoneText = Instance.new("TextLabel",BrimstoneFrame)
local SoulText = Instance.new("TextLabel",SoulFrame)
local BlazeText = Instance.new("TextLabel",BlazeFrame)
--//Brimstone Barrage\\--
BrimstoneFrame.Position = UDim2.new(0.139, 0,0.659, 0)
BrimstoneFrame.Size = UDim2.new(0,251,0,101)
BrimstoneFrame.Style = "DropShadow"
BrimstoneText.Postion = UDim2.new(0,0,0.257,0)
BrimstoneText.Size = UDim2.new(0,235,0,50)
BrimstoneText.Font = "Antique"
BrimstoneText.TextColor3 = Color3.fromRGB(255,0,0)
BrimstoneText.TextScaled = true
BrimstoneText.TextStrokeTransparency = 0
BrimstoneText.Text = "[Z] Brimstone Barrage"
BrimstoneText.BackgroundTransparency = 1
--//Soul Strike\\--
SoulFrame.Position = UDim2.new(0.398,0,0.659,0)
SoulFrame.Size = UDim2.new(0,251,0,101)
SoulFrame.Style = "DropShadow"
SoulText.Postion = UDim2.new(0,0,0.257,0)
SoulText.Size = UDim2.new(0,235,0,50)
SoulText.Font = "Antique"
SoulText.TextColor3 = Color3.fromRGB(255,0,0)
SoulText.TextScaled = true
SoulText.TextStrokeTransparency = 0
SoulText.Text = "[X] Soul Strike"
SoulText.BackgroundTransparency = 1
--//Blaze Beam\\--
SoulFrame.Position = UDim2.new(0.677,0,0.659,0)
SoulFrame.Size = UDim2.new(0,251,0,101)
SoulFrame.Style = "DropShadow"
SoulText.Postion = UDim2.new(0,0,0.257,0)
SoulText.Size = UDim2.new(0,235,0,50)
SoulText.Font = "Antique"
SoulText.TextColor3 = Color3.fromRGB(255,0,0)
SoulText.TextScaled = true
SoulText.TextStrokeTransparency = 0
SoulText.Text = "[C] Blaze Beam"
SoulText.BackgroundTransparency = 1

2 answers

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

Sorry, I had to skim through most of this as there is a lot to read here. But a couple things that stood out to me was

It looks like you're using the KeyDown event, which is deprecated.

It's better to use the UserInputService, i'll show you how you could use it in your code, then ill link you to the ROBLOX wiki for more information.

local UIS = game:GetService("UserInputService")

UIS.InputBegan:connect(function(inputObject, GPE) -- The input object is the key that was pressed

if not GPE then -- So the player cant use abilities while typing.
        if inputObject.KeyCode == Enum.KeyCode.Z and Attacking == false then
            Brimstone()
        elseif inputObject.KeyCode == Enum.KeyCode.X and Attacking == false then
            Soul()
        elseif inputObject.KeyCode == Enum.KeyCode.C and Attacking == false then
            Blaze()
        end
    end
end)

More info on the UserInputService here https://wiki.roblox.com/index.php?title=API:Class/UserInputService

It would also be a better idea to use elseif, instead of defining more if-statements for the same purpose.

The last thing I noticed was that the code could use better indentation and organizing, it can be an eyesore if everything just goes straight down, almost like a list.

These were just the things I noticed right off the bat, like I said I didn't read the entire thing, maybe someone else will see more.

0
Thanks! Mr_Unlucky 1085 — 5y
0
No problem man, don't forget to accept this answer if this helped you. jackfrost178 242 — 5y
Ad
Log in to vote
0
Answered by
Mr_Unlucky 1085 Moderation Voter
5 years ago

NOTE: I have edited it so it's much a bit better.

--[[ 
    Script by Mr_Unlucky
    Hello, to those who found this script, please dont remove the credits, and please dont leak.
    CONTROLS;
    [Z]; Brimstone Barrage
    [X]; Soul Strike
    [C]; Blaze Beam
--]]
--//=================================\\
--||          -=CONTROLS=-           ||
--\\=================================//
print("Script by Mr_Unlucky")
print("Hello, to those who found this script, please dont remove the credits.")
print("CONTROLS;")
print("[Z]; Brimstone Barrage")
print("[X]; Soul Strike")
print("[C]; Blaze Beam")
print("CREDITS")
print("SezHu - For the hat weld script. It wasn't copied and pasted, It was actually typed manually.")
print("Mr_Unlucky(me) - Scripted this.")
--//=================================\\
--||         -=VARIABLES=-           ||
--\\=================================//
--//MISCELLANEOUS\\--
Attacking = false -- These were implemented as a safety precaution so no one just uses all the moves at once.
BrimstoneBarrage = false
SoulStrike = false
BlazeBeam = false
Running = false
Hostile = false
CurrentTitle = "Demonic Entity"
--//PLAYER\\--
local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer
local Character = LocalPlayer.Character
local Humanoid = Character.Humanoid
local RightArm = Character["Right Arm"]
local LeftArm = Character["Left Arm"]
local RightLeg = Character["Right Leg"]
local LeftLeg = Character["Left Leg"]
local Torso = Character["Torso"]
local Head = Character["Head"]
local RootPart = Character["HumanoidRootPart"]
local Mouse = LocalPlayer:GetMouse()
local UIS = game:GetService("UserInputService")
--//=================================\\
--||     -=PLAYER CUSTOMIZATION=-    ||
--\\=================================//
--//AVATAR\\--
Humanoid.MaxHealth = math.huge
Humanoid.Health = math.huge
Humanoid.WalkSpeed = 110
Humanoid.JumpPower = 90
Character.Shirt:Destroy()
Character.Pants:Destroy()
local newShirt = Instance.new("Shirt",Character)
local newPants = Instance.new("Pants",Character)
newShirt.Name = "Shirt"
newPants.Name = "Pants"
newShirt.ShirtTemplate = "http://www.roblox.com/asset/?id=1013516988"
newPants.PantsTemplate = "http://www.roblox.com/asset/?id=1035284728"
HatHandle = Instance.new("Part")
HatMesh = Instance.new("SpecialMesh")
HatWeld = Instance.new("Weld")
HatHandle.Parent = Character
HatHandle.Name = "Handle"
HatHandle.CanCollide = false
HatHandle.Locked = true
HatHandle.Size = Vector3.new(1.93, 1.77, 1.6)
HatMesh.Parent = HatHandle
HatWeld.Part0 = Head
HatWeld.Part1 = HatHandle
HatWeld.C0 = CFrame.new(0,.4,0) * CFrame.fromEulerAnglesXYZ(math.rad(-1),0,0)VertexColor = Vector3.new(1,1,1)
HatHandle.Transparency = 0
HatMesh.MeshId = "http://www.roblox.com/asset/?id=62246019"
HatMesh.TextureId = "http://www.roblox.com/asset/?id=62246077" 
Head.face.Texture = "http://www.roblox.com/asset/?id=470245396"
for i,v in pairs (Character:GetChildren()) do
    if v.ClassName == "Hat" or "Accessory" then
        v:Destroy()
    end
end
--//TITLE\\--
local BillBoard = Instance.new("BillboardGui",Head)
local Title = Instance.new("TextLabel",BillBoard)
BillBoard.AlwaysOnTop = true
Title.Text = CurrentTitle
Title.Font = "Bodoni"
Title.TextColor3 = Color3.fromRGB(0,0,0)
Title.TextStrokeColor3 = Color3.fromRGB(255,0,0)
Title.TextStrokeTransparency = 0
Title.BackgroundTransparency = 1
Title.Size = UDim2.new(0,200,0,50)
Title.TextScaled = true
--//=================================\\
--||      -=ABILITIES/ATTACKS=-      ||
--\\=================================//
if not GPE then -- So the player cant use abilities while typing.
        if inputObject.KeyCode == Enum.KeyCode.Z and Attacking == false then
            Brimstone()
        elseif inputObject.KeyCode == Enum.KeyCode.X and Attacking == false then
            Soul()
        elseif inputObject.KeyCode == Enum.KeyCode.C and Attacking == false then
            Blaze()
        end
    end
end)
UIS.InputBegan:connect(function(inputObject, GPE) -- The input object is the key that was pressed
function Brimstone()
    print("Activating Brimstone Barrage")
    CurrentTitle = "Face the fury of brimstone!"
    Title.Text = CurrentTitle
    Attacking = true
    local MeteorCount = math.random(5,10)
    for i = MeteorCount, 1 do
        local Part = Instance.new("Part")
        local Mesh = Instance.new("SpecialMesh")
        Part.Size = Vector3.new(8,8,8)
        Part.Transparency = 1
        Part.Anchored = false
        Mesh.Parent = Part
        Mesh.Scale = Vector3.new(5,5,5)
        local PartX = math.random(Torso.CFrame.x-30,30)
        local PartZ = math.random(Torso.CFrame.z-30,30)
        Part.Position = CFrame.new(PartX,Torso.CFrame.Y+30,PartZ)
        local Fire = Instance.new("Fire",Part)
        Fire.Size = 100
        Fire.Heat = 20
        function onTouch(part)
        local humanoid = part.Parent:FindFirstChild("Humanoid")
        if (humanoid ~= nil) then
            humanoid.Health = 0
         Part.Touched:connect(onTouch)
    wait(0.4)
    CurrentTitle = "Demonic Entity"
    Title.Text = CurrentTitle
    Attacking = false
        end
    end
    end
    end

function Soul()
    print("Activating Soul Strike")
    CurrentTitle = "With the power of a thousand souls, attack!"
    Title.Text = CurrentTitle
    Attacking = true
    local Soul = Instance.new("Part")
    Soul.Transparency = 0.3
    Soul.Material = "Neon"
    Soul.Anchored = true
    Soul.Rotation = Vector3.new(0,0,90)
    Soul.Color = Color3.fromRGB()(255,255,255)
    Soul.Size = Vector3.new(38.59, 4.32, 9.58)
    Soul.Shape = "Cylinder"
    Soul:SetPrimaryPartCFrame(CFrame.new(Mouse.hit))
    function onTouch(part)
        local humanoid = part.Parent:FindFirstChild("Humanoid")
        if (humanoid ~= nil) then
            humanoid.Health = 0
    Soul.Touched:connect(onTouch)
    wait(0.5)
    Soul:Destroy()
    CurrentTitle = "Demonic Entity"
    Title.Text = CurrentTitle
    Attacking = false   
    end
        end
end

function Blaze()
    print("Activating Blaze Beam")
    CurrentTitle = "Feel the pain the sun's concentrated heat!"
    Title.Text = CurrentTitle
    Attacking = true
    local Blaze = Instance.new("Part")
    Blaze.Shape = "Cylinder"
    Blaze.Transparency = 0.35
    Blaze.Color = Color3.fromRGB(255,0,0)
    Blaze.CFrame = Torso.CFrame * CFrame.new(0, 0, -2)
    function onTouch(part)
        local humanoid = part.Parent:FindFirstChild("Humanoid")
        if (humanoid ~= nil) then
            humanoid.Health = 0
    Blaze.Touched:connect(onTouch)
    wait(0.5)
    Blaze:Destroy()
    CurrentTitle = "Demonic Entity"
    Title.Text = CurrentTitle
    Attacking = false
end
end
end
--//=================================\\
--||        -=USER INTERFACE=-       ||
--\\=================================//
local ScreenGui = Instance.new("ScreenGui",LocalPlayer.PlayerGui)
local BrimstoneFrame = Instance.new("Frame",ScreenGui)
local SoulFrame = Instance.new("Frame",ScreenGui)
local BlazeFrame = Instance.new("Frame",ScreenGui)
local BrimstoneText = Instance.new("TextLabel",BrimstoneFrame)
local SoulText = Instance.new("TextLabel",SoulFrame)
local BlazeText = Instance.new("TextLabel",BlazeFrame)
--//Brimstone Barrage\\--
BrimstoneFrame.Position = UDim2.new(0.139, 0,0.659, 0)
BrimstoneFrame.Size = UDim2.new(0,251,0,101)
BrimstoneFrame.Style = "DropShadow"
BrimstoneText.Position = UDim2.new(0,0,0.257,0)
BrimstoneText.Size = UDim2.new(0,235,0,50)
BrimstoneText.Font = "Antique"
BrimstoneText.TextColor3 = Color3.fromRGB(255,0,0)
BrimstoneText.TextScaled = true
BrimstoneText.TextStrokeTransparency = 0
BrimstoneText.Text = "[Z] Brimstone Barrage"
BrimstoneText.BackgroundTransparency = 1
--//Soul Strike\\--
SoulFrame.Position = UDim2.new(0.398,0,0.659,0)
SoulFrame.Size = UDim2.new(0,251,0,101)
SoulFrame.Style = "DropShadow"
SoulText.Position = UDim2.new(0,0,0.257,0)
SoulText.Size = UDim2.new(0,235,0,50)
SoulText.Font = "Antique"
SoulText.TextColor3 = Color3.fromRGB(255,0,0)
SoulText.TextScaled = true
SoulText.TextStrokeTransparency = 0
SoulText.Text = "[X] Soul Strike"
SoulText.BackgroundTransparency = 1
--//Blaze Beam\\--
SoulFrame.Position = UDim2.new(0.677,0,0.659,0)
SoulFrame.Size = UDim2.new(0,251,0,101)
SoulFrame.Style = "DropShadow"
SoulText.Position = UDim2.new(0,0,0.257,0)
SoulText.Size = UDim2.new(0,235,0,50)
SoulText.Font = "Antique"
SoulText.TextColor3 = Color3.fromRGB(255,0,0)
SoulText.TextScaled = true
SoulText.TextStrokeTransparency = 0
SoulText.Text = "[C] Blaze Beam"
SoulText.BackgroundTransparency = 1
0
You should have the UIS.InputBegan:connect(function(inputObject, GPE) on top, like how I wrote it, seems like you got it on the bottom there. jackfrost178 242 — 5y
0
k Mr_Unlucky 1085 — 5y

Answer this question