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

How do I turn this into a successful KeyDown script? I have tried many ways, but none have worked.

Asked by 10 years ago

How do I turn this into a successful KeyDown script? I have tried many ways, but none have worked.

wait(0)
bin = script.Parent
Player = script.Parent.Parent.Parent
enabled = true
function onButton1Down(mouse)
if not enabled then
return end
local player = game.Players.LocalPlayer
if player == nil then return end
enabled = false
LeftShoulder = Player.Character.Torso["Left Shoulder"]
RightShoulder = Player.Character.Torso["Right Shoulder"]
Run = game:GetService("RunService")
            for i = 1, 2 do
                LeftShoulder.C0 = LeftShoulder.C0 *CFrame.Angles(0, 0, 1.16)
                LeftShoulder.C0 = LeftShoulder.C0 *CFrame.Angles(0, -1.1, 0)
                Run.Stepped:wait(0.005)
            end
        game:GetService("Chat"):Chat(Player.Character.Head, "Fire Dragon's Claw!")

    MagicSym = Instance.new("Part")
    MagicSym.Parent = Player.Character
    MagicSym.Anchored = true
    MagicSym.CanCollide = false
    MagicSym.formFactor = "Symmetric"
    MagicSym.BrickColor = BrickColor.new("Really red")
    MagicSym.Transparency = 1
    MagicSym.Name = "MagicSym"
    MagicSym.Size = Vector3.new(10, 1, 10)
    MagicSym.TopSurface = "Smooth"
    MagicSym.BottomSurface = "Smooth"
    MagicSym.CFrame = Player.Character.Torso.CFrame*CFrame.new(0, 0, -5)*CFrame.fromEulerAnglesXYZ(-1.6, 0, 0)
f = Instance.new("Sparkles", MagicSym)
f.Color = Color3.new(255, 255, 255)
d = Instance.new("Decal")
d.Name = "Circle"
d.Parent = MagicSym
d.Face = "Top"
d.Texture = "http://www.roblox.com/asset/?id=156106262"
p = Instance.new("Decal")
p.Name = "Circle"
p.Parent = MagicSym
p.Face = "Bottom"
p.Texture = "http://www.roblox.com/asset/?id=156106262"
l = Instance.new("PointLight", MagicSym)
l.Brightness = 10
l.Range = 10
l.Color = Color3.new(255, 255, 255)

wait(1)
MagicSym:Remove()

wait()

        x = Instance.new("Part")
        x.BrickColor = BrickColor.new("Bright orange")
        x.Transparency = 0.5
        x.Size = Vector3.new(20, 20, 20)
        x.TopSurface = "Smooth"
        x.BottomSurface = "Smooth"
        x.Shape = "Block"
        x.Name = Player.Name
        x.CanCollide = false
        p = Instance.new("PointLight", x)
        p.Brightness = 10
        p.Range = 30
        p.Color = Color3.new(255, 0, 0)
        z = Instance.new("SpecialMesh", x)
        z.MeshId = "http://www.roblox.com/asset/?id=10681506"
        z.Scale = Vector3.new(20,20,-20)
        fd = script.Firedamage:clone()
        fd.Parent = x
        y = Instance.new("BodyVelocity")
        y.maxForce = Vector3.new(math.huge, math.huge, math.huge)
        y.velocity = Player.Character.Torso.CFrame.lookVector*200
        x.Parent = Workspace
        y.Parent = x
        x.CFrame = Player.Character.Torso.CFrame*CFrame.new(0, 0, -20)
        fd.Disabled = false
        game.Debris:AddItem(x, 20)
        for i = 1,40 do
            x2 = Instance.new("Part")
            x2.BrickColor = BrickColor.new("Medium red")
        x2.Transparency = 0.5
        x2.Size = Vector3.new(15, 15, 15)
        x2.TopSurface = "Smooth"
        x2.BottomSurface = "Smooth"
        x2.Shape = "Block"
        x2.CanCollide = false
        x2.Anchored = true
        p = Instance.new("PointLight", x2)
        p.Brightness = 10
        p.Range = 20
        p.Color = Color3.new(255, 0, 0)
        x2.Name = Player.Name
        fd = script.Firedamage:clone()
        fd.Parent = x2
        fd.Disabled = false
        x2.CFrame = x.CFrame * CFrame.Angles(math.random(-10, 10), math.random(-10, 10), math.random(-10, 10))
        x2.Parent = game.Workspace
        game.Debris:AddItem(x2, 0.2)
        wait()
        end
        x:remove()
        for i = 1, 2 do
            LeftShoulder.C0 = LeftShoulder.C0 *CFrame.Angles(0, 1.1, 0)
            LeftShoulder.C0 = LeftShoulder.C0 *CFrame.Angles(0, 0, -1.16)
            Run.Stepped:wait(0)
        end
      wait(4)

enabled = true
    end

enabled = true
function onS(mouse) 
mouse.Button1Down:connect(function() onButton1Down(mouse) end) 
end 
bin.Selected:connect(onS)

1 answer

Log in to vote
0
Answered by
Nexx 51
10 years ago

In what way? Like you want the function to run when the key is pressed instead of the mouse button?

If so, you would change line 117 to

mouse.KeyDown:connect(function(key) if (key == "b") then onButton1Down(mouse) end)

change the "key == '' " to whatever you want the key to be pressed as.

0
It didn't work. Relampago1204 73 — 10y
0
Is there any output errors you are now getting Relampago? Nexx 51 — 10y
Ad

Answer this question