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

Recreating Arcane Adventures? (Repost)

Asked by 7 years ago

So I've been working on a script that needs a lot of help, I'm making it open source for anybody who wants something but I currently only have the main basics with an exploding fireball. Debounce is one of my biggest issues so I made the whole script deactivate which is horrible, there's no "summoning circle" which is annoying, and the part that gets spawned in gets removed instantly. This is just the single "Q" blast, all I really need is for the "explosion" part to work and maybe I'll add a "humanoid damage" script onto it so it isn't an instant kill.

local Tool = script.parent
local ws = game:GetService("Workspace")
local me = game.Players.LocalPlayer
handle = me.Character.Torso


Tool.Equipped:connect(function(mouse)
    print("Ready!")
end)

local player = game.Players.LocalPlayer
local Mouse = player:GetMouse()
Anim = script.Animation


Mouse.KeyDown:connect(function(key)--PRESSED Q
    if key == "q" then
        print ("PRESSED Q!")
        s = player.Character.Humanoid:LoadAnimation(Anim)
        s:Play()
        local p = Instance.new("Part")--BLAST
        p.CFrame = CFrame.new(handle.Position)
        p.TopSurface = "Smooth" 
        p.BottomSurface = "Smooth" 
        p.Shape = Enum.PartType.Ball 
        p.Size = Vector3.new(2, 2, 2) 
        p.Transparency = (0.5)
        p.CanCollide = false
        p.Material = "Neon"
        p.BrickColor = BrickColor.new("Neon green")
        p.Parent = ws

     ------------------------------------------------------------Explode?--
        p.Touched:connect(function(hitpart) -- We now have the hit part, so let's use it!
            if hitpart.Parent.Name ~= player.Name then
                print("KABOOM!")
                local Explosion = Instance.new("Explosion")
                Explosion.BlastPressure = 100
                Explosion.BlastRadius = 3
                Explosion.Position = p -- Position of the explosion is p
                Explosion.Parent = game.Workspace
                p:Destroy() -- Destroy the fireball
            end
        end)
-----------------PARTICLES-----------------
local ParticleEffect = Instance.new("ParticleEmitter")
ParticleEffect.Size = NumberSequence.new(2)
ParticleEffect.Transparency = NumberSequence.new(0.5)
ParticleEffect.LightEmission = 0.3
ParticleEffect.Rate = 2860
ParticleEffect.Parent = p
ParticleEffect.Acceleration = Vector3.new(0,0,0)
ParticleEffect.Lifetime = NumberRange.new(0.2)
ParticleEffect.Speed = NumberRange.new(1)
ParticleEffect.Rotation = NumberRange.new(-360,360)
ParticleEffect.RotSpeed = NumberRange.new(-360,360)
ParticleEffect.Texture = "http://www.roblox.com/asset/?id=296874871"
---woosh---
local woosh = Instance.new("Sound")
woosh.SoundId = "rbxassetid://463598785"
woosh.Volume = 10
woosh.MaxDistance = 250000
woosh.EmitterSize = 1
woosh.Parent = p
woosh.Playing = true
--MOVE--
local bv = Instance.new("BodyVelocity")
bv.Parent = p 
bv.velocity = (Mouse.Hit.p - handle.Position).unit*100
game:GetService("Debris"):AddItem(p, 7)
end
--STAP!!!-- (Don't know how to use debounce)
script.Disabled = true
wait (2)
script.Disabled = false
end)

Tool.Unequipped:connect(function()
    print("Unequipped!")
end)


I'd really appreciate it if anybody could help.

0
you can put this inside a local script in a tool and test it out for yourself, just add the animation inside the script and name it "Anim" Shadowthaumaturge 97 — 7y
0
Whos Eryn rexpex 45 — 7y
0
Help me plss To Create this Script and how you create Alegre_satinitigan 0 — 5y

2 answers

Log in to vote
0
Answered by 7 years ago

Before you read, know that there might be grammar or spelling issues that you might not be able to decipher.

You might not understand some of the things I'm trying to explain to you.

There ALSOOOO might be coding errors.

I can't comment on your post for some reason so, if you're having one of the above problems, friend me on ROBLOX.

Or, if you can message me, message me. lol

Hi there. I played around with your animation, and I figured out your problem.

I also found other issues that you probably want to fix.

You need to create the WHOLE BLAST before you add the explosion function.

If that didn't make sense, you have to add your particles, sound and velocity before you make your function that explodes your projectile.

This is because your function checks if your projectile is being touched before it even moved.

Also, there are two problems with your script.

In your explosion function, it only checks if the hitpart's parent's name does not equal the user's name.

However, if the projectile touched the user's hat, it would have exploded the user. This is because the hat's parent wouldn't equal the user's name.

The other problem is that you assigned your explosion's position to the blast.

You should have assigned the explosion's position to the blast's POSITION.

To fix your explosion function, replace it with this new one:

  p.Touched:connect(function(hitpart) 
            print("KABOOM!")

            if hitpart.Parent.Name ~= player.Name and hitpart.Parent.Parent.Name ~= player.Name then  --Added another condition that fixes the hat glitch.

                local Explosion = Instance.new("Explosion")
                Explosion.BlastPressure = 100
                Explosion.BlastRadius = 3
                Explosion.Position = p.Position --Fixed the explosion's position.
                Explosion.Parent = game.Workspace
                p:Destroy() 

            end

        end)

ALSO, you have two variables that are assigned to the player. You only need one.

And, I notice you're not good with debounces. lol

What you want to do is make a variable and check if it is true or false.

Here's the debounce method I use:

local player = game.Players.LocalPlayer
local mouse = player:GetMouse()

local enabled = true --Create the debounce variable.

local cooldown = 2

mouse.KeyDown:connect(function(key)
    if not enabled then return end --If the variable isn't true, then don't run code.
    enabled = false --Makes the variable false so the code doesn't run too many times  at      ---------once                    

    if key == "q" then
        --Run code.
    end

    wait(cooldown) --Waits two seconds before the function can run again.
    enabled = true --Makes the variable true so the function can run again.
end)

So, in the start of the function, the code checks if the debounce variable is false.

If it is false, then it doesn't run the code.

Now, we make the debounce variable false so the code can't run too many times at once.

You might be asking, "why doesn't the code disable?".

It doesn't disable because our code didn't check if it was disabled.

We only checked the variable at the start of the function.

This is also why the code doesn't run more than one time at once.

To fix your WHOLE script, replace it with this organized new one:

local ws = game:GetService("Workspace")


local Tool = script.parent

local player = game.Players.LocalPlayer
local Mouse = player:GetMouse()
local handle = player.Character.Torso

local Anim = script:WaitForChild("Animation")

local enabled = true


Tool.Equipped:connect(function(mouse)
    print("Ready!")
end)

Mouse.KeyDown:connect(function(key)
    if not enabled then return end --Doesn't run function, unless it's enabled.
    enabled = false --Makes enabled false so they can't run the function again.

    if key == "q" then

        print ("PRESSED Q!")

        --Ready Animation--
        local s = player.Character.Humanoid:LoadAnimation(Anim)
        s:Play()
        -------------------

        --Create Blast--
        local p = Instance.new("Part")
        p.CFrame = CFrame.new(handle.Position)
        p.TopSurface = "Smooth" 
        p.BottomSurface = "Smooth" 
        p.Shape = Enum.PartType.Ball 
        p.Size = Vector3.new(2, 2, 2) 
        p.Transparency = (0.5)
        p.CanCollide = false
        p.Material = "Neon"
        p.BrickColor = BrickColor.new("Neon green")
        p.Parent = ws
        -----------------

        --Add Particles--
        local ParticleEffect = Instance.new("ParticleEmitter")
        ParticleEffect.Size = NumberSequence.new(2)
        ParticleEffect.Transparency = NumberSequence.new(0.5)
        ParticleEffect.LightEmission = 0.3
        ParticleEffect.Rate = 2860
        ParticleEffect.Parent = p
        ParticleEffect.Acceleration = Vector3.new(0,0,0)
        ParticleEffect.Lifetime = NumberRange.new(0.2)
        ParticleEffect.Speed = NumberRange.new(1)
        ParticleEffect.Rotation = NumberRange.new(-360,360)
        ParticleEffect.RotSpeed = NumberRange.new(-360,360)
        ParticleEffect.Texture = "http://www.roblox.com/asset/?id=296874871"
        ------------------

        --Add Sound--
        local woosh = Instance.new("Sound")
        woosh.SoundId = "rbxassetid://463598785"
        woosh.Volume = 10
        woosh.MaxDistance = 250000
        woosh.EmitterSize = 1
        woosh.Parent = p
        woosh.Playing = true
        --------------

        --Add Velocity--
        local bv = Instance.new("BodyVelocity")
        bv.Parent = p 
        bv.velocity = (Mouse.Hit.p - handle.Position).unit*100
        game:GetService("Debris"):AddItem(p, 7)
        ----------------

        --Add Explosion Function--
        p.Touched:connect(function(hitpart) 
            print("checking")

            if hitpart.Parent.Name ~= player.Name and hitpart.Parent.Parent.Name ~= player.Name then 
                local Explosion = Instance.new("Explosion")
                Explosion.BlastPressure = 100
                Explosion.BlastRadius = 3
                Explosion.Position = p.Position 
                Explosion.Parent = game.Workspace
                p:Destroy() 
            end

        end)
        ------------------


    end

wait(2) --Cooldown
enabled = true --Makes the function useable again.

end)

Tool.Unequipped:connect(function()
    print("Unequipped!")
end)


0
Ignore what I said above. I can comment on my answer. If you have any of the problems above, just comment here. :D iiTylerSoul 56 — 7y
0
Oops. I had an error in my comment, so ignore it. If you can't decipher some grammar or spelling issues / don't understand some of the things I tried to explain to you / the code I gave you doesn't work, then ask. iiTylerSoul 56 — 7y
0
Also, if this answer works for you, please accept it as your answer. (: iiTylerSoul 56 — 7y
0
And, if you want to make your projectile more realistic, add an explosion sound or something on to the explosion function. iiTylerSoul 56 — 7y
View all comments (3 more)
0
Sorry for so many comments. But, you might want to make it where it doesn't explode when it touches the Baseplate. iiTylerSoul 56 — 7y
0
This is PERFECT! Thank you so much! I can add the sound effects later on and I really appreciate the help on this one! Shadowthaumaturge 97 — 7y
0
No problem. :D iiTylerSoul 56 — 7y
Ad
Log in to vote
0
Answered by 7 years ago

Thank you ^~^ Final product for core script, you're welcome newbies! :D

local ws = game:GetService("Workspace")


local Tool = script.parent

local player = game.Players.LocalPlayer
local Mouse = player:GetMouse()
local handle = player.Character.Torso

local Anim = script:WaitForChild("Animation")

local enabled = true


Tool.Equipped:connect(function(mouse)
    print("Ready!")
end)

Mouse.KeyDown:connect(function(key)
    if not enabled then return end --Doesn't run function, unless it's enabled.
    enabled = false --Makes enabled false so they can't run the function again.

    if key == "q" then

        print ("PRESSED Q!")

        --Ready Animation--
        local s = player.Character.Humanoid:LoadAnimation(Anim)
        s:Play()
        -------------------

        --Create Blast--
        local p = Instance.new("Part")
        p.CFrame = CFrame.new(handle.Position)
        p.TopSurface = "Smooth" 
        p.BottomSurface = "Smooth" 
        p.Shape = Enum.PartType.Ball 
        p.Size = Vector3.new(2, 2, 2) 
        p.Transparency = (0.5)
        p.CanCollide = false
        p.Material = "Neon"
        p.BrickColor = BrickColor.new("Neon green")
        p.Parent = ws
        -----------------

        --Add Particles--
        local ParticleEffect = Instance.new("ParticleEmitter")
        ParticleEffect.Size = NumberSequence.new(5)
        ParticleEffect.Transparency = NumberSequence.new(0.8)
        ParticleEffect.LightEmission = 0.3
        ParticleEffect.Rate = 2860
        ParticleEffect.Parent = p
        ParticleEffect.Acceleration = Vector3.new(0,0,0)
        ParticleEffect.Lifetime = NumberRange.new(0.2)
        ParticleEffect.Speed = NumberRange.new(1)
        ParticleEffect.Rotation = NumberRange.new(-360,360)
        ParticleEffect.RotSpeed = NumberRange.new(-360,360)
        ParticleEffect.Texture = "http://www.roblox.com/asset/?id=296874871"
        ------------------

        --Add Sounds--
        local woosh = Instance.new("Sound")
        woosh.SoundId = "rbxassetid://463598785"
        woosh.Volume = 100
        woosh.MaxDistance = 250000
        woosh.EmitterSize = 4
        woosh.Parent = p
        woosh.Playing = true

        local woosh2 = Instance.new("Sound")
        woosh2.SoundId = "rbxassetid://428046152"
        woosh2.Volume = 100
        woosh2.MaxDistance = 25000000
        woosh2.EmitterSize = 5
        woosh2.Parent = p
        woosh2.Playing = true
        woosh2.Looped = true
        --------------

        --Add Velocity--
        local bv = Instance.new("BodyVelocity")
        bv.Parent = p 
        bv.velocity = (Mouse.Hit.p - handle.Position).unit*100
        game:GetService("Debris"):AddItem(p, 7)
        ----------------

        --Add Explosion Function--
        p.Touched:connect(function(hitpart) 
            print("checking")

            if hitpart.Parent.Name ~= player.Name and hitpart.Parent.Parent.Name ~= player.Name then 
                local Explosion = Instance.new("Explosion")
                local ExplodeSound = Instance.new("Sound")
                local SoundDecoy = Instance.new("Part")--Create a sound decoy for realistic sound placement

                SoundDecoy.TopSurface = "Smooth" 
                SoundDecoy.BottomSurface = "Smooth" 
                SoundDecoy.Shape = Enum.PartType.Ball 
                SoundDecoy.Size = Vector3.new(2, 2, 2) 
                SoundDecoy.Transparency = (1)
                SoundDecoy.CanCollide = true
                SoundDecoy.Position = p.Position
                SoundDecoy.Parent = game.Workspace

                ExplodeSound.SoundId = "rbxassetid://304448425"
                ExplodeSound.Volume = 1
                ExplodeSound.MaxDistance = 1000
                ExplodeSound.EmitterSize = 1
                ExplodeSound.Parent = SoundDecoy--Can't be located inside the part because sound would be cut short
                ExplodeSound.Playing = true

                Explosion.BlastPressure = 100
                Explosion.BlastRadius = 3
                Explosion.Position = p.Position 
                Explosion.Parent = game.Workspace
                p:Destroy() 
            end

        end)
        ------------------


    end

wait(1) --Cooldown
enabled = true --Makes the function useable again.

end)

Tool.Unequipped:connect(function()
    print("Unequipped!")
end)



0
Hello there can i get Script of arcane and how you Create a Script like Arcane adcentures Alegre_satinitigan 0 — 5y

Answer this question