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

How would i make this script activate when you press a key?

Asked by
exarlus 72
6 years ago

I have basically tried keydown and useinputservice and i still cant get it to work.

anim=Instance.new("Animation",workspace)
anim.AnimationId = "http://www.roblox.com/Asset?ID=293536378"
jun = script.Parent.Parent
Stuff = false
local sp = script.Parent
local s = Instance.new("Sound")
s.SoundId = "http://www.roblox.com/asset/?id=213733166"
s.Volume = 3
s.Looped = true
s.PlayOnRemove = false
s.Parent = sp
--password
function ssj()
    s:Play()    
        for loop = 1,50 do
            delay(0,function()
            local x = Instance.new("Part")
            game.Debris:AddItem(x, 3)
            x.CanCollide = false
            x.Anchored = true
            x.Size = Vector3.new(1,1,1)
            x.Material = "Neon"
            x.TopSurface = "Smooth"
            x.BottomSurface = "Smooth"
            x.Parent = game.Workspace
            x.CFrame = jun.Character.UpperTorso.CFrame
            x.BrickColor = BrickColor.new("Bright blue")

            local m1 = Instance.new("BlockMesh", x)
            delay(0,function()
            for loop = 1,20 do
                m1.Scale = m1.Scale + Vector3.new(1,1,1)
                x.CFrame = x.CFrame * CFrame.Angles(0.2,0.2,0.2)
                x.Transparency = x.Transparency + 0.05
                wait()
            end
            end)
            end)
            delay(0,function()
            local x = Instance.new("Part")
            game.Debris:AddItem(x, 4)
            x.Size = Vector3.new(1,1,1)
            x.CanCollide = false
            x.Anchored = true
            x.CFrame = jun.Character.UpperTorso.CFrame * CFrame.new(0,-2.5,0)
            x.TopSurface = "Smooth"
            x.BottomSurface = "Smooth"
            x.BrickColor = BrickColor.new("Bright blue")
            x.Parent = game.Workspace

            local m1 = Instance.new("SpecialMesh", x)
            m1.MeshId = "http://www.roblox.com/asset/?id=20329976"
            delay(0,function()
            for loop = 1,100 do
                m1.Scale = m1.Scale + Vector3.new(1,0.1,1)
                x.Transparency = x.Transparency + 0.02
                x.CFrame = x.CFrame * CFrame.Angles(0,1,0)
                wait()
            end
            end)
            end)
            wait(0.1)
        end

if Stuff == false then
Stuff = true
for u, c in pairs (jun.Character:GetChildren()) do
if c.className == "Accessory" and c.Name ~= "Swordpack" and c.Name ~= "GlassesBlackFrame" then
c.Handle.Transparency = 1
end
end
local Hair4 = game.ReplicatedStorage.SSJGSSJ:Clone()
Hair4.Parent = jun.Character
Hair4.Name = "Hair"
Hair4.CanCollide = false
Hair4.Locked = true
Hair4.CFrame = jun.Character.UpperTorso.CFrame
local Weld = Instance.new("Weld")
Weld.Parent = jun.Character.Head
Weld.Part0 = jun.Character.Head
Weld.Part1 = Hair4
Weld.C0 = CFrame.new(0, .8, 0.11) * CFrame.Angles(0,math.pi,0)
if jun.Character.UpperTorso:findFirstChild("PwnFire") == nil then
local animTrack = jun.Character.Humanoid:LoadAnimation(anim)
animTrack:Play()  
    wait()
    local fr = game.lighting.ParticleEmitterd:clone()
    fr.Parent = jun.Character.UpperTorso
end
if jun.Character.UpperTorso:findFirstChild("PwnSparkles") == nil then
    local cr = game.lighting.ParticleEmitterd0:clone()
    cr.Parent = jun.Character.UpperTorso
    local br = game.lighting.ParticleEmitterd1:clone()
    br.Parent = jun.Character.UpperTorso
end
jun.Character.Humanoid.MaxHealth = 1e+8
wait(0.3)
jun.Character.Humanoid.Health = 1e+8
end
end
function nossj()
if Stuff == true then
Stuff = false
if jun.Character.UpperTorso:findFirstChild("ParticleEmitter150")~=nil then
jun.Character.UpperTorso:findFirstChild("ParticleEmitter150"):Remove()
end
if jun.Character.UpperTorso:findFirstChild("ParticleEmitter1500")~=nil then
jun.Character.UpperTorso:findFirstChild("ParticleEmitter1500"):Remove()
end
if jun.Character.UpperTorso:findFirstChild("ParticleEmitter15000")~=nil then
jun.Character.UpperTorso:findFirstChild("ParticleEmitter15000"):Remove()
end
     local p = Instance.new("Part")
     p.Parent = jun.Character
     p.Anchored = true
     p.CanCollide = false
     p.Transparency = 0.1
     p.formFactor = "Symmetric"
     p.Size = Vector3.new(22, 22, 22)
     p.TopSurface = "Smooth"
     p.BottomSurface = "Smooth"
     p.Name = "Sharingan"
     p.Shape = "Ball"
     p.CFrame = jun.Character.UpperTorso.CFrame
     p.BrickColor = BrickColor.new("New Yeller")
     for i = 1 , 10 do
      wait(0.05)
      p.Size = p.Size + Vector3.new(-4, -4, -4)
      p.Transparency = p.Transparency + 0.1
      p.CFrame = jun.Character.UpperTorso.CFrame
     end
s.Volume = 0
p:Remove()
for u, c in pairs (jun.Character:GetChildren()) do
if c.className == "Hat" and c.Name ~= "Swordpack" and c.Name ~= "GlassesBlackFrame" then
c.Handle.Transparency = 0
end
if c.Name == "Hair" then
c:Remove()
end
end
jun.Character.Humanoid.Health = 100
wait(0.3)
jun.Character.Humanoid.MaxHealth = 100
end
end
jun.Chatted:connect(function(Msg)
 local msg = Msg:lower()
 if string.sub(msg, 1, 7) == "super saiyan god super saiyan super" then
 wait(0.1)
  ssj()
 end
 if string.sub(msg, 1, 13) == "ssjb" then
 wait(0.1)
  ssj()
 end
 if string.sub(msg, 1, 6) == "!" then
 wait(0.1)
  ssj()
 end
 if string.sub(msg, 1, 10) == "calm" then
 wait(0.1)
  nossj()
 end
 if string.sub(msg, 1, 3) == "off" then
 wait(0.1)
  nossj()
 end
end)
function OnDeath()
wait()
nossj()
end
jun.Character.Humanoid.Died:connect(OnDeath)
jun = script.Parent.Parent
Stuff = false
--mediafire---

1 answer

Log in to vote
0
Answered by
oSyM8V3N 429 Moderation Voter
6 years ago

You can use the UserInputService, since keyDown is deprecated

local UIS = game:GetService("UserInputService")
local debounce = false

UIS.InputBegan:Connect(function(Input, gameProcessed)
local KeyCode = Input.KeyCode
if not gameProcessed then

if KeyCode == Enum.KeyCode.keyhere and debounce == false then
--code here or put ssj()

end
end
end)

Any Questions or Errors, please feel free to ask

--oSy

0
Where would i put this script sorry? exarlus 72 — 6y
0
Local script, anything that has to do with the player goes in a local script. Mr_MilkysButler 47 — 6y
0
V, same thing he said oSyM8V3N 429 — 6y
Ad

Answer this question