local cas = game:GetService('ContextActionService')
Didnât work for me. I donât know man
Without what Iâve suggested, I have no problem.
https://gyazo.com/e1e2bd92ef04aea37d7063d387cef1b1
local Players = game:GetService("Players")
local Debounce = {}
script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChildOfClass("Humanoid") and not Debounce[Players:GetPlayerFromCharacter(hit.Parent)] == true then
local player = Players:GetPlayerFromCharacter(hit.Parent)
if not player then return; end;
Debounce[player] = true
local character = player.Character
local humanoid = character.Humanoid
delay(.3, function()
humanoid.WalkSpeed = 0
humanoid.JumpPower = 0
end)
local animTrack = nil
local animation = Instance.new("Animation")
animation.AnimationId = "rbxassetid://" .. 6344077782
animTrack = humanoid:LoadAnimation(animation)
animTrack:Play()
animTrack.Stopped:Wait()
delay(.3, function()
humanoid.WalkSpeed = 16
humanoid.JumpPower = 50
end)
end
end)
Thank you man. I figured out I made the wrong variable then fixed it quickly. Thanks again
If you used this method:
remote.OnClientEvent:Connect(function()
cas:UnbindAction("sprint")
if ifSprintAnimPlaying then
sprintAnim:Stop()
ifSprintAnimPlaying = false
end
end)
remember when the animation is finished, re-bind âsprintâ action
Rebind? How can i possibly do that
After the playerâs character is âtransformedâ or something, can you sprint again ?
No. The animation of sprinting just loops when you hold W,A,S,D even when transforming and after. And the sprinting does not work when holding shift
Do you want to be able to sprint after being transformed ?
Yes. I do its just a transformation not a unsprintable one
Because when you unbind an action with context action service you are not being able to sprint normally
and to be able to repeat this action you need to re-bind the action
Well do you possibly have another method I can use instead of CAS?
When the transformed animation is finished just do in the running local script
cas:BindAction("Sprint", function(_,inputState)
if inputState == Enum.UserInputState.Begin then
sprint("Begin")
else
sprint("Ended")
end
end, true, Enum.KeyCode.LeftShift)
To re-bind an action you just need to use cas:BindAction()
Alright yea that worked. But how can I make it where when the transforming anim is playing and you hold WASD it doesnt play the run anim?
remote.OnClientEvent:Connect(function()
cas:UnbindAction("sprint")
if ifSprintAnimPlaying then
sprintAnim:Stop()
ifSprintAnimPlaying = false
end
delay(3, function()
cas:BindAction("Sprint", function(_,inputState)
if inputState == Enum.UserInputState.Begin then
sprint("Begin")
else
sprint("Ended")
end
end, true, Enum.KeyCode.LeftShift)
end)
end)
Can you show a video of your problem?
Heres the video link/mp4.
Where are you playing the transformation animation ?
In the part script ?
Threw a module script in ServerStorage
I try to find a solution
Since the topic is âclosedâ because the problem is solved, can we just DM each other?