How can I prevent this script from running when the player keeps pressing z?
me = script.Parent.Parent.Parent
player = script.Parent.Parent.Parent
function onKeyDown(key)
key:lower()
if key == "z" then
enabled = true
function Talk(msg)
game:GetService("Chat"):Chat(player.Character.Head, msg, Enum.ChatColor.Blue)
end
local player = game.Players.LocalPlayer
if player == nil then return end
enabled = false
Run = game:GetService("RunService")
for i = 1, 3 do
Run.Stepped:wait(0.005)
end
Talk("Sky Dragon's Healing Spell!")
MagicSym = Instance.new("Part")
MagicSym.Parent = me.Character
MagicSym.Anchored = true
MagicSym.CanCollide = false
MagicSym.formFactor = "Symmetric"
MagicSym.BrickColor = BrickColor.new("Teal")
MagicSym.Transparency = 1
MagicSym.Name = "MagicSym"
MagicSym.Size = Vector3.new(10, 1, 10)
MagicSym.TopSurface = "Smooth"
MagicSym.BottomSurface = "Smooth"
MagicSym.CFrame = me.Character.Torso.CFrame*CFrame.new(0, -3, 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=214848485"
p = Instance.new("Decal")
p.Name = "Circle"
p.Parent = MagicSym
p.Face = "Bottom"
p.Texture = "http://www.roblox.com/asset/?id=214848485"
l = Instance.new("PointLight", MagicSym)
l.Brightness = 10
l.Range = 10
l.Color = Color3.new(255, 255, 255)
wait(1)
MagicSym:Remove()
wait(10)
j = me.Character.Head
k = me.Character.Torso
q = me.Character["Left Arm"]
w = me.Character["Left Leg"]
e = me.Character["Right Arm"]
r = me.Character["Right Leg"]
me.Character.Humanoid.Health = me.Character.Humanoid.Health + 10
wait(1.5)
for i = 1, 3 do
end
wait()
enabled = false
end
wait(10)
enabled = true
end
function onSelected(mouse)
mouse.KeyDown:connect(onKeyDown)
end
script.Parent.Selected:connect(onSelected)