#Help me PLS

1 messages · Page 1 of 1 (latest)

vagrant pagoda
#

I'm making a cooldown click script but it dont funcion

glacial stone
vagrant pagoda
#

ou

#

if PlayerCombos[Players] > 4 then
humanoid:Move(humanoid.Parent.HumanoidRootPart.Position)
humanoid.WalkSpeed = 0 -- Congela el movimiento
humanoid.JumpHeight = 0 -- Evita el salto
CanAttack[player] = false

    task.wait(Cooldowntime)
    humanoid.WalkSpeed = 16 
    humanoid.JumpHeight = 7
peak onyxBOT
#

studio** You are now Level 1! **studio

vagrant pagoda
#

@split thistle

split thistle
#

What?

#

I don't get the script

vagrant pagoda
#

srry

#

the script is a combat handler

#

when you do a click then get a animation

#

its a battleground btw

#

when you go to 4 animation you have to get cooldown and cant move

#

but i cant get the last

split thistle
vagrant pagoda
#

sure

vagrant pagoda
#

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")

local ClickAttack = ReplicatedStorage.Events:WaitForChild("ClickAttack")
local AttackAnimations = ReplicatedStorage:WaitForChild("AttackAnimations"):GetChildren()

local Cooldowntime = 2
local COOLDOWN_BETWEEN_ATTACKS = 0.5 
local AttackCooldown = {} 
local PlayerCombos = {} 
local ActiveAnimations = {} 
local CanAttack = {} 



ClickAttack.OnServerEvent:Connect(function(player)
    local Personaje = Player.Character
    if not Personaje then return end

    local humanoid = Personaje:FindFirstChild("Humanoid")
    local animator = humanoid and humanoid:FindFirstChild("Animator")

    if not humanoid or not animator then return end


    if (AttackCooldown[player] and tick() < AttackCooldown[player]) or CanAttack[player] == false then
        return
    end


    if not PlayerCombos[player] then
        PlayerCombos[player] = 1
    end

    
    if ActiveAnimations[player] then
        ActiveAnimations[player]:Stop()
    end


    local animationIndex = PlayerCombos[player]
    local animation = AttackAnimations[animationIndex]
    if not animation then return end

    PlayerCombos[Players] = PlayerCombos[player] + 1


    if PlayerCombos[Players] > 4 then

        
        humanoid:Move(humanoid.Parent.HumanoidRootPart.Position) 
        humanoid.WalkSpeed = 0 
        humanoid.JumpHeight = 0

        
        CanAttack[player] = false 

        task.wait(Cooldowntime)

        
        humanoid.WalkSpeed = 16 
        humanoid.JumpHeight = 7 

        
        PlayerCombos[player] = 1
        ActiveAnimations[player] = nil

        
        CanAttack[player] = true  
    else 
        end
    end)
#

that is the whole script

#

Do you notice anything strange?

#

@split thistle

vagrant pagoda
#

ready

#

anything wrong?

#

im almost new in this so i cant detec the errors easy

split thistle
#

I'm reading

split thistle
vagrant pagoda
peak onyxBOT
#

studio** You are now Level 2! **studio

vagrant pagoda
#

okay

split thistle
#

I didn't rlly get it 😅

vagrant pagoda
pearl seal
#

what do you store attackcooldown[player] as?

#

time?

#

name?

vagrant pagoda
#

idk thats why im searching for help

#

can you help me?

pearl seal
#

you're comparing tick agains the player

split thistle
#

Lemme read through the script

pearl seal
#

@split thistle He set canattack to true at the end

#

the condition u want is canattack == falsee

vagrant pagoda
#

help me pls i doing this game for 3 months and i have this problem whole time

#

the scripts

vagrant pagoda
pearl seal
#

canattack[player] is litterally nil

pearl seal
vagrant pagoda
pearl seal
#

you can keep spamming it?

vagrant pagoda
#

is the unique thing is dont funcion

vagrant pagoda
#

yes

#

yes

#

thats righ

split thistle
#

Dont set it to nil at the end

#

Set it to false

vagrant pagoda
#

ready

split thistle
#

Also

#

You should handle animations and hitbox on client

#

Combo can be server

#

But

#

If anything, anims should at least be from client

#

Especially since its just an m1

#

You can still play victim hit on server

pearl seal
#

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")

local ClickAttack = ReplicatedStorage.Events:WaitForChild("ClickAttack")
local AttackAnimations = ReplicatedStorage:WaitForChild("AttackAnimations"):GetChildren()

local Cooldowntime = 2
local COOLDOWN_BETWEEN_ATTACKS = 0.5 
local AttackCooldown = {} 
local PlayerCombos = {} 
local ActiveAnimations = {} 
local CanAttack = {} 



ClickAttack.OnServerEvent:Connect(function(player)
    local Personaje = Player.Character
    if not Personaje then return end

    local humanoid = Personaje:FindFirstChild("Humanoid")
    local animator = humanoid and humanoid:FindFirstChild("Animator")

    if not humanoid or not animator then return end


    if  CanAttack[player] == false then
        return
    end


    if not PlayerCombos[player] then
        PlayerCombos[player] = 1
    end

    
    if ActiveAnimations[player] then
        ActiveAnimations[player]:Stop()
    end


    local animationIndex = PlayerCombos[player]
    local animation = AttackAnimations[animationIndex]
    if not animation then return end

    PlayerCombos[Players] = PlayerCombos[player] + 1


    if PlayerCombos[Players] > 4 then

        
        humanoid:Move(humanoid.Parent.HumanoidRootPart.Position) 
        humanoid.WalkSpeed = 0 
        humanoid.JumpHeight = 0

        
        CanAttack[player] = true

        task.wait(Cooldowntime)

        
        humanoid.WalkSpeed = 16 
        humanoid.JumpHeight = 7 

        
        PlayerCombos[player] = 1
        ActiveAnimations[player] = nil

        
        CanAttack[player] = false
    else 
        end
    end)
#

try that

#

wait.

split thistle
#

I feel like renaming the table to OnCooldown

pearl seal
#

i know why it

split thistle
#

Would be better

#

And just adding the player

pearl seal
#

no no

vagrant pagoda
pearl seal
#

wait..

split thistle
#

And checking if they are in it

#

Cuz its kinda confusing

pearl seal
#

@vagrant pagoda Are u trying to do hit combo cooldown

split thistle
#

Looking at it

split thistle
vagrant pagoda
#

when the character got 4 anim get cooldown

#

so player

#

cant move

#

cant jump

#

cant do M1

#

cant do anything

pearl seal
#

try the one i gave u

vagrant pagoda
#

i will tryy

#

mmmm

#

nop

#

it doesnt funcion

split thistle
#

Why is it if combo > 4

vagrant pagoda
#

if PlayerCombos[Players] > 4 then

#

that?

split thistle
#

Yeah

#

Also

#

Why is it Players?

#

And not player

split thistle
vagrant pagoda
#

i forgot put the mayus

split thistle
#

?

vagrant pagoda
#

okay i will confess

#

the script is not mine 100% some parts its do by IA

split thistle
#

Its not yours?

vagrant pagoda
split thistle
#

Yeah I figured

vagrant pagoda
#

sorry

#

i dont know to much to script so i recoverd to ia

peak onyxBOT
#

studio** You are now Level 3! **studio

split thistle
vagrant pagoda
split thistle
#

Lemme try fix it on pc

vagrant pagoda
vagrant pagoda
split thistle
#
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")

local ClickAttack = ReplicatedStorage.Events:WaitForChild("ClickAttack")
local AttackAnimations = ReplicatedStorage:WaitForChild("AttackAnimations"):GetChildren()

local Cooldowntime = 2
local COOLDOWN_BETWEEN_ATTACKS = 0.5 
local AttackCooldown = {} 
local PlayerCombos = {} 
local ActiveAnimations = {} 
local M1Cooldown = {} 

ClickAttack.OnServerEvent:Connect(function(player)
    local Personaje = Player.Character
    if not Personaje then return end

    local humanoid = Personaje:FindFirstChild("Humanoid")
    local animator = humanoid and humanoid:FindFirstChild("Animator")

    if not humanoid or not animator then return end


    if (AttackCooldown[player] and tick() < AttackCooldown[player]) or M1Cooldown[player] then
        return
    end


    if not PlayerCombos[player] then
        PlayerCombos[player] = 1
    end

    
    if ActiveAnimations[player] then
        ActiveAnimations[player]:Stop()
    end


    local animationIndex = PlayerCombos[player]
    local animation = AttackAnimations[animationIndex]
    if not animation then return end

    PlayerCombos[player] = PlayerCombos[player] + 1


    if PlayerCombos[player] >= 4 then

        
        humanoid:Move(humanoid.Parent.HumanoidRootPart.Position) 
        humanoid.WalkSpeed = 0 
        humanoid.JumpHeight = 0

        
        M1Cooldown[player] = true

        task.wait(Cooldowntime)

        humanoid.WalkSpeed = 16 
        humanoid.JumpHeight = 7 

        
        PlayerCombos[player] = 1
        ActiveAnimations[player] = nil

        
        M1Cooldown[player] = nil
    else 
        end
    end)
#

@vagrant pagoda

#

trythis

vagrant pagoda
#

okay

split thistle
#

if theres any console errors lmk

vagrant pagoda
#

thx for help again and sorry

#

@split thistle

#

isnt working

#

console "error" is this

#

who i got to put?

#

the line code is this

#

local Personaje = Player.Character

split thistle
#

make player lowercase

split thistle
vagrant pagoda
#

okay

#

YI

#

YO

#

@split thistle

split thistle
#

Yeah

vagrant pagoda
#

THE COOLDOWN IS RIGHT BUT NO SO RIGHT

#

when i do a click the cooldown works buuuutt

#

i want when i do the 4 click

#

the cooldown get true

#

ah and i still cant punch

split thistle
#

Oh

vagrant pagoda
#

okay let me try do something

split thistle
#

Alr

vagrant pagoda
#

okay

#

My scripting soul was on fire, but not hot enough to fix the code.

#

@pearl seal

#

can you help?

#

@split thistle

#

should i try put the

#

PlayerCombos[player] = 4?

split thistle
#

No

vagrant pagoda
#

okay

peak onyxBOT
#

studio** You are now Level 4! **studio

vagrant pagoda
#

what if

#

i put a animation =false ?

split thistle
#
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")

local ClickAttack = ReplicatedStorage.Events:WaitForChild("ClickAttack")
local AttackAnimations = ReplicatedStorage:WaitForChild("AttackAnimations"):GetChildren()

local Cooldowntime = 2
local COOLDOWN_BETWEEN_ATTACKS = 0.5 
local AttackCooldown = {} 
local PlayerCombos = {} 
local ActiveAnimations = {} 
local M1Cooldown = {} 

ClickAttack.OnServerEvent:Connect(function(player)
    local Personaje = Player.Character
    if not Personaje then return end

    local humanoid = Personaje:FindFirstChild("Humanoid")
    local animator = humanoid and humanoid:FindFirstChild("Animator")

    if not humanoid or not animator then return end


    if M1Cooldown[player] then
        return
    end


    if not PlayerCombos[player] then
        PlayerCombos[player] = 1
    end

    
    if ActiveAnimations[player] then
        ActiveAnimations[player]:Stop()
    end


    local animationIndex = PlayerCombos[player]
    local animation = AttackAnimations[animationIndex]
    if not animation then return end

    PlayerCombos[player] = PlayerCombos[player] + 1


    if PlayerCombos[player] >= 4 then

        
        humanoid:Move(humanoid.Parent.HumanoidRootPart.Position) 
        humanoid.WalkSpeed = 0 
        humanoid.JumpHeight = 0

        
        M1Cooldown[player] = true

        task.wait(Cooldowntime)

        humanoid.WalkSpeed = 16 
        humanoid.JumpHeight = 7 

        
        PlayerCombos[player] = 1
        ActiveAnimations[player] = nil

        
        M1Cooldown[player] = nil
    else 
        end
    end)
#

Try this ig

vagrant pagoda
#

okay i will try

#

thx for help

#

we go back to the start point

#

the cooldown got false lol

#

@split thistle do you want to record what my Character do on the game? so you can see what is grong with the code

split thistle
#

Yes

vagrant pagoda
#

send you priv or here?

split thistle
vagrant pagoda
#

@split thistle this work ?

#

idk how to put the video video

split thistle
#

But

#

I cant watch rn

#

I gotta afk

#

I'll be back later

vagrant pagoda
#

okeee

#

@frigid isle (sorry for tag but i see you have a rarelly icon scripter) can you help me?

frigid isle
#

ok so whats ur issue

#

@vagrant pagoda

vagrant pagoda
#

thank you

#

ok mi issue is

#

i am creating a battleground, but i have a several issue, when i do a click mi cooldown get true and the animations still can play

#

@frigid isle

frigid isle
vagrant pagoda
#

thats is not me but btw

#

i understand english very well dont problem with communication

frigid isle
#

ok

vagrant pagoda
#

so

frigid isle
#

so what are you trying to do

vagrant pagoda
#

the cooldown is right but i can still do the animation

frigid isle
#

are we looking at the right code right now

vagrant pagoda
#

yea that is the right code

frigid isle
vagrant pagoda
#

so i should agree a animation play?

frigid isle
frigid isle
#

but in this piece of code, you have nothing that is related to playing the animation

#

which is why im confused ur having a problem

vagrant pagoda
#

local animationIndex = PlayerCombos[player]
local animation = AttackAnimations[animationIndex]
if not animation then return end

frigid isle
#

is this your full code?

vagrant pagoda
# frigid isle is this your full code?
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")

local ClickAttack = ReplicatedStorage.Events:WaitForChild("ClickAttack")
local AttackAnimations = ReplicatedStorage:WaitForChild("AttackAnimations"):GetChildren()

local Cooldowntime = 1.5
local COOLDOWN_BETWEEN_ATTACKS = 0.5 
local AttackCooldown = {} 
local PlayerCombos = {} 
local ActiveAnimations = {} 
local M1Cooldown = {} 

ClickAttack.OnServerEvent:Connect(function(player)
    local Personaje = player.Character
    if not Personaje then return end

    local humanoid = Personaje:FindFirstChild("Humanoid")
    local animator = humanoid and humanoid:FindFirstChild("Animator")

    if not humanoid or not animator then return end


    if M1Cooldown[player] then
        return
    end


    if not PlayerCombos[player] then
        PlayerCombos[player] = 1
    end


    if ActiveAnimations[player] then
        ActiveAnimations[player]:Stop()
    end


    local animationIndex = PlayerCombos[player]
    local animation = AttackAnimations[animationIndex]
    if not animation then return end

    PlayerCombos[player] = PlayerCombos[player] + 1


    if PlayerCombos[player] >= 4 then


        humanoid:Move(humanoid.Parent.HumanoidRootPart.Position) 
        humanoid.WalkSpeed = 0 
        humanoid.JumpHeight = 0


        M1Cooldown[player] = true

        task.wait(Cooldowntime)

        humanoid.WalkSpeed = 16 
        humanoid.JumpHeight = 7 


        PlayerCombos[player] = 1
        ActiveAnimations[player] = nil


        M1Cooldown[player] = nil
    else 
    end
end)

#

o

#

srry i dont get it

#

@frigid isle

#

thats my full code

#

can you tell me how to repair or something?

frigid isle
#

I cant im sorry

#

i have to talk ab something

vagrant pagoda
#

:,c

peak onyxBOT
#

studio** You are now Level 5! **studio