I'm trying to get KeyDown events to work for this script but it doesnt seem to work. I checked the Explorer's hierarchy and there isn't anything wrong there. Im also am not getting any output errors. Please help I tried everything. look for key events
`~~~~~~~~~~~~~~~~~ c=script.Parent CC=c.ComboCounter.CC Player=game.Players.LocalPlayer Mouse=Player:GetMouse() Combo=c.Combo.Value Lose=c.Lose.Value HitV=c.ComboCounter.HitV Points=c.Points.Value MC=c.MC.Value
-- turn back to false
--Functions of Movers
function L() local A1=Instance.new("ImageButton") A1.Position=UDim2.new(0,0,1.006, 0) A1.Size=UDim2.new(-0.163,100,0, 100) A1.Parent=c.Lanes.Lane1 A1.Name="A1"
A1:TweenPosition(UDim2.new(0,0,-0.219,0)) end function U() local B1=Instance.new("ImageButton") B1.Position =UDim2.new(0, 0,1.006, 0) B1.Size=UDim2.new(-0.163,100,0, 100) B1.Parent=c.Lanes.Lane3 B1.Name="B1"
B1:TweenPosition(UDim2.new(0,0,-0.219,0)) end function D() local C1=Instance.new("ImageButton") C1.Position=UDim2.new(0, 0,1.006, 0) C1.Size=UDim2.new(-0.163,100,0, 100) C1.Parent=c.Lanes.Lane2 C1.Name="C1"
C1:TweenPosition(UDim2.new(0,0,-0.219,0))
end function R() local D1=Instance.new("ImageButton") D1.Position=UDim2.new(0, 0,1.006, 0) D1.Size=UDim2.new(-0.163, 100,0, 100) D1.Parent=c.Lanes.Lane4 D1.Name="D1"
D1:TweenPosition(UDim2.new(0,0,-0.219,0))
end
-------------------Commands
-- works from here up
function CC1() if MC<=Combo then MC=Combo+1 else return end Combo=Combo+1 Points=Points+10 c.ComboCounter.PC.Text=Points CC.Text=Combo CC.FontSize=Enum.FontSize.Size48 wait(0.2) CC.FontSize=Enum.FontSize.Size36 --[[if (c.Points)>= (c.Points("100")) then CC.TextStrokeColor3(255,170,0)
end if (c.Points)<=99 then CC.TextStrokeColor3(0,0,0)]] end function GameOver1() c.Lanes.Visible=false c.PowerBar.Health.Visible=false c.ComboCounter.Visible=false wait(1) c.GameOver.Visible=true c.GameOver.Add.Visible=true c.GameOver.Add.Points2.Text=Points c.GameOver.Add.MC2.Text=MC wait(5) c.GameOver.Add.Visible=false --MC2=c.GameOver.Add.MC2*2 --c.GameOver.Final.CC=(c.Points)+(MC2) end -- Power Bar Functions function Cool1() c.PowerBar.Health.Size=c.PowerBar.Health.Size+UDim2.new(0.025,0,0,0) HitV.Text="Cool" --HitV.TextStrokeColor(0,153,255) end
function Perfect1() c.PowerBar.Health.Size=c.PowerBar.Health.Size+UDim2.new(0.1,0,0,0) HitV.Text="Perfect" --HitV.TextStrokeColor.new(174,255,80) end
function Bad() if c.PowerBar.Health.Size.X.Scale<=0.1 then GameOver1() else c.PowerBar.Health.Size=c.PowerBar.Health.Size - UDim2.new(0.1,0,0,0) Combo=0 CC.Text=0 HitV.Text="Bad" --HitV.TextStrokeColor3=(227,0,0)
--Key Events **function z(key)
if key=="z" then if c.Lanes.Lane1.A1.Position.Y.Scale >=0.202 or c.Lanes.Lane1.A1 == false then -- could this work? Bad() print'Bad' elseif c.Lanes.Lane1.A1.Position.Y.Scale >= 0 and c.Lanes.Lane1.A1.Position.Y.Scale <= 0.161 then Cool1() CC1() print'cool' elseif c.Lanes.Lane1.A1.Position.Y.Scale >= 0 and c.Lanes.Lane1.A1.Position.Y.Scale<= 0.059 then Perfect1()CC1() print 'Perfect'end end end
--Down
function x(key)
if key=="x"then
if c.Lanes.Lane2.C1.Position.Y.Scale>=0.202 or c.Lanes.Lane2.C1 == false then Bad() print'Bad2' elseif c.Lanes.Lane2.C1.Position.Y.Scale >=0 and c.Lanes.Lane2.C1.Position.Y.Scale<=0.161 then Cool1() CC1() print 'Cool2' elseif c.Lanes.Lane2.C1.Position.Y.Scale>= 0 and c.Lanes.Lane2.C1.Position.Y.Scale<= 0.059 then Perfect1()CC1() print("perfect2") end end end
--Up
function n(key)
if key=="n" then if c.Lanes.Lane3.B1.Position.Y.Scale>=0.202 or c.Lanes.Lane3.B1 == false then Bad() print'Bad3' elseif key=="n" and c.Lanes.Lane3.B1.Position.Y.Scale>=0 and c.Lanes.Lane3.B1.Position.Y.Scale<=0.161 then Cool1() CC1() print 'Cool3' elseif key=="n" and c.Lanes.Lane3.B1.Position.Y.Scale>=0 and c.Lanes.Lane3.B1.Position.Y.Scale<=0.059 then Perfect1() CC1() print("perfect3") end end end --Right
function m(key)
if key=="m"then if c.Lanes.Lane4.D1.Position.Y.Scale>=0.202 or c.Lanes.Lane4.D1 == false then Bad() print'Bad4' elseif c.Lanes.Lane4.D1.Position.Y.Scale>=0 and c.Lanes.Lane4.D1.Position.Y.Scale>=0.161 then Cool1() CC1() print'Cool4' elseif c.Lanes.Lane4.D1.Position.Y.Scale>=0 and c.Lanes.Lane4.D1.Position.Y.Scale<=0.059 then Perfect1() CC1() print("perfect4") end
end end
while true do wait(2) if Lose==false then i=math.random(1,4) --print (i) if i==1 then L() elseif i==2 then D() elseif i==3 then U() elseif i==4 then R() end end end
--[[function Song1() local s1=script.Parent.Parent.Song1 s1:play() L()wait(1) L()wait(1) U()wait(1) D() wait(1) R()wait(1) R() wait(1) s1:Stop() end wait(1) Song1()]]
Mouse.KeyDown:connect(z) Mouse.KeyDown:connect(x) Mouse.KeyDown:connect(n) Mouse.KeyDown:connect(m) ~~~~~~~~~~~~~~~~~ `