Why does "Jumped" always return false?
so im trying to make a spindash (ability from Sonic) script
and i've run into a problem where if you hold shift in the air, the first half obviously doesnt execute, but if you then release shift after you landed the second half does execute, i tried to bandage this with a "Jumped" value that should be changed to true if the player holds shift while in the air. Yet it always returns false whenever i ask it to be printed
01 | local UIS = game:GetService( "UserInputService" ) |
02 | local Player = game.Players.LocalPlayer.Character |
03 | local humanoid = Player.Humanoid |
04 | local anim = Instance.new( "Animation" ) |
09 | local playAnimA = humanoid:LoadAnimation(anim) |
11 | UIS.InputBegan:Connect( function (inst) |
13 | if humanoid:GetState() ~ = Enum.HumanoidStateType.Freefall then |
14 | if inst.KeyCode = = Enum.KeyCode.LeftShift then |
16 | Player.HumanoidRootPart.Anchored = true |
18 | Player.TrailPart.Smoke.Enabled = true |
19 | Player.TrailPart.Dirt.Enabled = true |
20 | if inst.KeyCode = = Enum.KeyCode.LeftShift then |
24 | if inst.KeyCode = = Enum.KeyCode.LeftShift then |
27 | if inst.KeyCode = = Enum.KeyCode.LeftShift then |
30 | if inst.KeyCode = = Enum.KeyCode.LeftShift then |
42 | UIS.InputEnded:Connect( function (inst) |
43 | if humanoid:GetState() ~ = Enum.HumanoidStateType.Freefall then |
44 | if Jumped = = false then |
45 | if inst.KeyCode = = Enum.KeyCode.LeftShift then |
46 | print ( "Jumped is" = = Jumped) |
48 | Player.HumanoidRootPart.Anchored = false |
49 | Player.TrailPart.Smoke.Enabled = false |
50 | Player.TrailPart.Dirt.Enabled = false |
52 | humanoid.WalkSpeed = counter |
53 | humanoid.JumpPower = humanoid.JumpPower + 24 |
54 | Player.TrailPart.Trail.Enabled = true |
56 | if inst.KeyCode = = Enum.KeyCode.Space then |
57 | humanoid.WalkSpeed = humanoid.WalkSpeed - 25 |
58 | humanoid.JumpPower = humanoid.JumpPower - 24 |
61 | humanoid.WalkSpeed = humanoid.WalkSpeed - 10 |
62 | humanoid.JumpPower = humanoid.JumpPower - 24 |
64 | humanoid.WalkSpeed = humanoid.WalkSpeed - 15 |
66 | humanoid.WalkSpeed = OrgWS |
68 | Player.TrailPart.Trail.Enabled = false |
here's is the localscript btw.