my thoughts: when i click a button (mousebutton1) it will start the animation and will stop the animation at the end, then when i click te button again it will be turn in to normal.
the bug is: the player goes back to normal without the second click
extra information: I speak Portuguese, so some parts of the script are written in Portuguese
#My animation don't stop at the time i say to stop (i used Chat-gpt)
1 messages · Page 1 of 1 (latest)
local UserInputService = game:GetService("UserInputService")
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local poseAnimation = Instance.new("Animation")
poseAnimation.AnimationId = "rbxassetid://95827014638144"
local poseTrack
local isPosing = false
local function setupAnimation()
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
poseTrack = humanoid:LoadAnimation(poseAnimation)
poseTrack.Priority = Enum.AnimationPriority.Action
poseTrack.Looped = false
end
setupAnimation()
player.CharacterAdded:Connect(setupAnimation)
UserInputService.InputBegan:Connect(function(input, gameProcessed)
if gameProcessed then return end
if input.UserInputType == Enum.UserInputType.MouseButton1 and poseTrack then
if not isPosing then
poseTrack:Play()
-- Congela quando chegar perto do final
task.delay(poseTrack.Length, function()
if poseTrack.IsPlaying then
poseTrack:AdjustSpeed(0) -- congela na última posição
end
end)
isPosing = true
else
-- Faz voltar ao normal
poseTrack:Play()
poseTrack.TimePosition = poseTrack.Length
poseTrack:AdjustSpeed(-1)
task.wait(poseTrack.Length)
poseTrack:Stop()
poseTrack:AdjustSpeed(1)
isPosing = false
end
end
end)
that script is a poop? or chat-gpt did "right"?
the code just not stop in the position that i want, i think i just need to put a code that GPT don't know
By button you mean your mouse?
** You are now Level 1! **
Bro whats is ts 😭
It can be any button actually, I just have to change it in the script
You are making it so that if it isint playing then start playing it and after that you wait the lenght of the animation and freeze it. But if it is playing and you clicked then it STILL STARTS PLAYING IT then waits the whole track lenght again?
Ion know what the adjust speed -1 should do tho
... im using the translator sorry
, one second
** You are now Level 1! **
Do you want it to stop entirely or to freeze it ?
stop at the end of the animation
And freeze it normaly?
the "player" will still walk normaly
with the animation
what do you mean with "freeze it normaly"? the character can't move in that situation?
I mean the animation
yes, the animation will still be freezed until i click again
local UserInputService = game:GetService("UserInputService")
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local poseAnimation = Instance.new("Animation")
poseAnimation.AnimationId = "rbxassetid://95827014638144"
local poseTrack
local isPosing = false
local function setupAnimation()
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
poseTrack = humanoid:LoadAnimation(poseAnimation)
poseTrack.Priority = Enum.AnimationPriority.Action
poseTrack.Looped = false
end
setupAnimation()
player.CharacterAdded:Connect(setupAnimation)
UserInputService.InputBegan:Connect(function(input, gameProcessed)
if gameProcessed then return end
if input.UserInputType == Enum.UserInputType.MouseButton1 and poseTrack then
if not isPosing then
poseTrack:Play()
-- Congela quando chegar perto do final
task.delay(poseTrack.Length - poseTrack.TimePosition, function()
if poseTrack.IsPlaying and isPosing then
poseTrack:Stop()
end
end)
isPosing = true
else
-- Faz voltar ao normal
poseTrack:Pause()
--poseTrack:AdjustSpeed(-1)
isPosing = false
end
end
end)
done?????!?!?!?!?!?
Idk much about animations and im on a phone so i cant really like see it
Maybe
You instead want to pause the animation
trying
Instead of playing it again the second tims
PlayPoseOnClick:38: Pause is not a valid member of AnimationTrack "Animation"
Uhh replace it with Stop
i do that
Wait no
now the game don't crash, but do the same thing as before
ok
Instead of pause
i think im doing wrong
** You are now Level 2! **
in that part you say to turn in to Stop right?
if yes, still turning back to normal without the click
i need to sleep sorry, tomorrow im coming back
i think the problem is here
task.delay(poseTrack.Length - poseTrack.TimePosition, function()
task.delay(poseTrack.Length - poseTrack.TimePosition, function()
if poseTrack.IsPlaying and isPosing then
poseTrack:Stop()
end
end)
someone help
i did something!!!!!
now when i click the animation goes normaly, but if i click during the animation it freeze at the time i had clicked (i think i wrote it right... im not good in english)