Title says it all. I had coded in a sprint button which doesn't work as intended, and am now left a little confused as to why. When the player first presses shift they'll still be in sprinting mode even when they stop, and this only changes to the intended behavior (of holding it down at the same time) when the shift key is pressed a second time. Naturally, this is very annoying and I can see this error becoming a nuisance very quickly. . .
#Sprint button works weirdly
1 messages · Page 1 of 1 (latest)
Sorry in advance for the .txt, discord won't let me post the full script otherwise ToT
youre making a new connection every time the movedirection changes
typically not good
anyway
** You are now Level 9! **
Do you have any advice on how to go about doing that?
you should probably start bu moving the input connections away from the getpropertychangedsignal
and honestly that alone would probably fix your problem
Ill try that out later this evening (I have chores to do lol)
But the original reason I put them into getpropertychangedsignal was so that my skating animation would actually stop and play respectively whenever the player character moves
Would it be easy to achieve the same effect without stuffing the inputs in there like I have now?
It probably is and im just not able to see it now xD
yeah but the issue here is that youre rebinding every time
Ohhh okay, I see
I fixed the sprint button, but the issue I was having with the skating animation is back
By chance would you know how to get the animation to stop while the player is idle?
local function startSkating()
skating = true
humanoid.WalkSpeed = skateSpeed
humanoid.JumpPower = 0
skatingAnimTrack:Play()
end
local function stopSkating()
skating = false
skatingAnimTrack:Stop()
humanoid.JumpPower = 30
humanoid.WalkSpeed = normalWalkSpeed
end
--Skating keybinds
humanoid:GetPropertyChangedSignal("MoveDirection"):Connect(function()
if humanoid.MoveDirection.Magnitude > 0 and skatingAnimTrack.IsPlaying == false and skating == false then
UserService.InputBegan:Connect(function(input, gameProcessedEvent)
if Skate(input) then
startSkating()
end
end)
elseif humanoid.MoveDirection.Magnitude == 0 and skatingAnimTrack.IsPlaying == true and skating == true then
stopSkating()
end
end) --PC/Console```
Heres the current code related to it