ChargeReleasedEvent.OnServerEvent:Connect(function(plr) -- this happens on user inputservice.inputended
IsCharging[plr.UserId] = false
task.delay(3, function()
IsCharging[plr.UserId] = true
end)
end)
if skill == "ChargedSmash" then -- OnInputBegan
if PlayerCooldowns[plr.UserId][skill] then return end -- check if ChargedSmash is on cooldown
PlayerCooldowns[plr.UserId][skill] = true
task.delay(10, function()
PlayerCooldowns[plr.UserId][skill] = nil
end)
if PlayerCooldowns[plr.UserId].SkillInAction then return end
PlayerCooldowns[plr.UserId].SkillInAction = true -- code is cooked, skills wont player after one is finished
local Charge = rs['Animations']["GreenHeroAnims"].ChargeSmash
local Smash = rs['Animations']["GreenHeroAnims"].ChargeSmashRelease
local ChargeTrack = hum.Animator:LoadAnimation(Charge)
local SmashTrack = hum.Animator:LoadAnimation(Smash)
local ChargeAmount = 0
IsCharging[plr.UserId] = true
ChargeTrack:GetMarkerReachedSignal("Charge1"):Connect(function()
ChargeAmount += 1
print("1")
if not IsCharging[plr.UserId] then
ChargeTrack:Stop()
SmashTrack:Play()
end
end)
ChargeTrack:GetMarkerReachedSignal("Charge2"):Connect(function()
ChargeAmount += 1
print("2")
if not IsCharging[plr.UserId] then
ChargeTrack:Stop()
SmashTrack:Play()
end
end)
ChargeTrack:GetMarkerReachedSignal("Charge3"):Connect(function()
ChargeAmount += 1
print("3")
IsCharging[plr.UserId] = true -- do it for the player who doesn't want to let go, stubborn player...
ChargeTrack:Stop()
SmashTrack:Play()
end)
ChargeTrack:Play() -- start the charging```
#Animation not stopping after I tell it to using GetMarketReachedSignal, only stops at the end
1 messages · Page 1 of 1 (latest)
Please note the if skill == ChargedSmash is in another event connected function
To sum the issue up, the animation keeps playing until the third marker (or the end of the anim, idk which) and only then plays the smash animation. I want to make it so if the player releases early, the smash attack occurs, sooner, specifically checking if the skill key is still being held at each marker, and if not, the charge should stop and the smash should start
And what does that function do?
basically it starts the animation and then gets the animation events
and then checks to see if the button has been released by the player yet through the ischarging table and the player's id
Are these GetMarkerReachedSignalEvents firing? You get all the print() functions?
Have you tried to use Animation:Destroy() after the :Stop() method?
i have not, but if destroy it should i use a clone instance instead?
dumb question obviously i should
maybe
Cant be that,
Animation Priority is Different from Animation Properties.
Ya, you're right
Oh, both...
chat gpt says that if i stop the animation in the market it won't work, but i dont know where else i could put them
** You are now Level 9! **
Cant you just detect on how long they've been holding it down for? or how long it has been playing rather than relying on animation signals?
Cause they only fire Once
like get key frame instead?
Nada,
How are you even handling this?
does it depend on how long a keypress has been made?
or depending on how long it has been on before being pressed again?
nah just uis input began ane ended
uis.InputBegan:Connect(function(input, isTyping) -- charge smash
if isTyping then return end
if input.KeyCode == Enum.KeyCode.Two then
event:FireServer("ChargedSmash")
end
end)
uis.InputEnded:Connect(function(input, isTyping) -- charge smash end
if isTyping then return end
if input.KeyCode == Enum.KeyCode.Two then
event:FireServer("ChargedSmashEnd")
end
end)
local script part^
I mean he was talking about the client tracking the time and sending it to the server @terse abyss
Try instead to track how long they've been holding it for
and use < & > instead of animation signals
sorry but im like a baby scripter how can i detect how long they've been holding for? os clock or tick()?
if i remember correctly, Animation signals only fire and doesnt wait unlike functions.
or anything that waits
both options work
would you mind scripting an example for me? I know that's asking a bit much but im lowk lost, im a visual learner ._.
i havent really done any os.clock or tick() scripts tbh 😭
ive been using while _ do
LOL

fair enough, maybe i can get chat gpt to give me and example then ill just make practice exercices from that
I'll write some example
local currentTime = tick()
-- An event here
local elapsed_Time = tick() - currentTime
if you want go ahead
but in all honesty, this isj ust my opinion, dont know about the others
theres probably hundreds of ways doing this
🤷♂️
all i can say is goodluck twin

@terse abyss The optimization stuff I was talking about:
Instead of asking your script to try to find an animation object in ReplicatedStorage everytime this events fires, store it outside the function scope. Doing that you can Load its clones and this will give you some small performance changes.
Is there a point to replicating if it if im not going to destroy it?
But you will
After it finishes you should destroy it
Wdym lol
hey pookies
doing either may have some slight differences, but it just depends on how big the game is
Maintaining good habits is always good
@terse abyss
Or you either store a connection to disconnect manually later, or you can use the :Once() method, which will, as it says, run the function once and disconnect itself automatically
i think were getting a bit too off topic here mate
Like SomeEvent.OnServerEvent:Once(function() end)
also :Once literally speaks for itself
What's the problem
it only fires it ** ONCE **
"as it says"
yeah, but his issue is the animation is not stopping
You already gave him some light, bro, he's working on the problem by himself, I'm just giving some tips as long as he said he's a beginner on scripting
ah
And memory leaks are terrible
but overall these can be the possible issues:
-
Animation signals were never met,
-
Animation signals only runs once, never waiting for something else.
oh wait
i have a fix LOL
yeah its late for me and im too lazy to script rn, so ill test out the time that the player releases the key method and send that to the server tmr, and if that doesnt work ill try the 'At this keyframe, do this" method
thank you for the encouragement lol
So, just to finish, @terse abyss
Example of how you can store your connections:
-- Define it as a global variable, outside any function
local connections = {}
-- And when you need to add a connection inside a function you do that:
connections['someMarkerConnection'] = Animation:GetMarkerReachedSignal:Connect(function()
end)
-- After you finish with this connection
if connections'[someMarkerConnection'] then
connections['someMarkerConnection']:Disconnect()
connections['someMarkerConnection'] = nil
end
Gl with your game, bye
thx man
You guys wont believe how dumb i am. I binded the wrong event to the input ended on the local script
omg it worked, ALL I HAD TO DO WAS CHANGE ONE VARIABLE I HATE BEING A PLEB 😭
LOL
good thing you fixed it!
hahahaha no way, bro
