Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Script doesnt run after character change?

Asked by 2 years ago

after you press f and change character the melee attack wont work like it just doesnt run when i press E

local plr = game.Players.LocalPlayer
local UIS = game:GetService("UserInputService")
local MeleeDb = false
local shifted = false

--//Shift

local keybind = Enum.KeyCode.F
UIS.InputBegan:Connect(function(input, gameprocessed)
    if gameprocessed then return end

    if input.KeyCode == keybind then

        script.Shift:FireServer()   

        shifted = true

    end

end)

--//Melee Attack

local Melee = Enum.KeyCode.E
UIS.InputBegan:Connect(function(input, gameprocessed)
    if gameprocessed then return end

    if input.KeyCode == Melee then
        print("done")
        if shifted == true and MeleeDb == false then
        print("REALdone")   
        script.Melee:FireServer()   
            MeleeDb = true
            wait(0.5)
            MeleeDb = false
        end
    end
end)
1
Localscript is probably placed in wrong place for this, it would help if we knew the events too maybe BeautifulAuraLover 371 — 2y
0
you are right thanks Not_prototype 50 — 2y

Answer this question