I'm trying to create a tool free game. I am a novice Scripter and I am curious as to how I can allow for this function (Key Down()) to work without putting it in a HopperBin, BackPack. The reason i'm not using the backpack is because the Gui Objects inside the PlayerGui are received as nil. So for now I'm leaving the "LocalScript" in the Gui Object. Here is the main line: (assume the variables are defined)Excerpt
m.KeyDown:connect() if key=="a" and c.Lane1.A1.Position.Y<=c.Lane1.Left.UDim2(0,0,54.5,0) then Bad=true print'Bad'elseif...
This is the output I recieve if I attempt to put this script inside the StarterPack :
**DDR1 is not a valid member of PlayerGui
21:25:14.040 - Script 'Players.Player1.Backpack.Script', Line 3
21:25:14.040 - Stack End**
This is another error I get :
01:12:11.524 - Players.Player1.PlayerGui.DDR1.DDR.Script:48: attempt to compare userdata with number
01:12:11.525 - Stack Begin
01:12:11.525 - Script 'Players.Player1.PlayerGui.DDR1.DDR.Script', Line 48
01:12:11.526 - Stack End
Filtering Enabled is off, I've checked this forum,Script Builders,and the Wikia for answers. None of them worked. The Hierarchy is: game.StarterGui.DDR.Script or if I put it in the Starter Pack... game.StarterPack.Script
this is the full script:
--Variables p=game.Players.LocalPlayer c=script.Parent L1=c.Lane1.A1 L2=c.Lane2.A2 L3=c.Lane3.A3 L4=c.Lane4.A4 m=p:GetMouse() -- turn back to false Lost=false Win=false Bad=false Cool=false --Functions function Left() L1.Transparency=0 L1:TweenPosition(UDim2.new(0,0,-0.219,0)) wait(1.5) L1.Transparency=1 L1:TweenPosition(UDim2.new(0,0,1.006,0)) end function Down() L2.Transparency=0 L2:TweenPosition(UDim2.new(0,0,-0.219,0)) wait(1.5) L2.Transparency=1 L2:TweenPosition(UDim2.new(0,0,1.006,0)) end function Up() L3.Transparency=0 L3:TweenPosition(UDim2.new(0,0,-0.219,0)) wait(1.5) L3.Transparency=1 L3:TweenPosition(UDim2.new(0,0,1.006,0)) end function Right() L4.Transparency=0 L4:TweenPosition(UDim2.new(0,0,-0.219,0)) wait(1.5) L4.Transparency=1 L4:TweenPosition(UDim2.new(0,0,1.006,0)) end m.KeyDown:connect(function(key) if key=="a" and L1.AbsolutePosition.Y>c.Bad.AbsolutePosition then Bad=true print'Bad' elseif key=="a" and (L1.Position.Y>c.Perfect) and (c.L1.Position.Y<=c.Bad) then Cool=true print'cool' elseif key=="a" and (L1.Position.Y==c.Perfect) then Perfect =true print 'Perfect' end end) while true do wait(1) i=math.random(1,4) print (i) if i==1 then Down() elseif i==2 then Down() elseif i==3 then Right() elseif i==4 then Up() end end
So... If I understand you correctly, this is what you need to change.
function Start() m.KeyDown:connect(function()--line 43 if statement to check hit or not end--line 59 end) end
Also, you need to call Start() at some point before you start the while loop. You have Start = true in your Begin function, but Start is a function in and of itself.
Also, this should be in PlayerGui... I don't think it makes sense to have it in Backpack like a hopperbin, so leave it in StarterGui