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

My local function doesn't run properly through the actual game, but in studio it's the opposite?

Asked by
Tokyo7979 131
5 years ago

For some odd reason, the local function for my combat isn't working. I've tried looking through it multiple times to look for server functions that aren't supposed to be in the local script, but it still continues to do act the same.

Here is the block of code(Don't pay attention to the commented lines):

local function combat()
    if equipped==false or player.Character:FindFirstChild("BlockValue").Value==1 then return end
    print("Test complete 1")
    ---------------- punching animations ----------------------------------
    local punch = Instance.new("Animation")
    punch.AnimationId = "http://www.roblox.com/asset/?id=03643750429"
    local loadanim1 = humanoid:LoadAnimation(punch)
    local punchh = Instance.new("Animation")
    punchh.AnimationId = "http://www.roblox.com/asset/?id=03643732182"
    local loadanim = humanoid:LoadAnimation(punchh)
    ------------------ combo stuff --------------------------------------
    if P == false and P2 == false then
    db = true
    enableDamage:FireServer()
    loadanim:Play()
    wait(.4)
    loadanim:Stop()
    disableDamage:FireServer()
    P = true
    db = false
    repeat wait() until loadanim:Stop()
    end
    --local effects = math.random(1,5)
    if P == true and P2 == false then
    db = false
    wait(.8)
    enableDamage:FireServer()
    loadanim1:Play()
    -------
--if effects == 3 then 
    ---Remote:FireServer()
--print("Knockback")
    -------
    wait(.4)
    loadanim1:Stop()
    disableDamage:FireServer()
    P = false
    P2 = false
    db = false
--end
    repeat wait() until loadanim1:Stop()
    end
    ------------------------------ combo end -------------------------------
end

Note: The local function is called when the player presses they're M1 while a tool is equipped. Also, P/P2 are both variables to make sure the server switches the arm animations.

If you wish for me to be more specific please do so.

0
Please be more specific, what exactly is not working. Does the function run at all? Also function being local has nothing to do with script being local. These are completely two different things. sleazel 1287 — 5y
0
Any errors? Where is the script put? Torren_Mr 334 — 5y
0
What isn't working is the punching animation for the right and left hands. Yes the function does run. Also the script is inside a tool. Another thing is that in the console log, all it shows is, "Test Complete 1"(which is from my own printing). Tokyo7979 131 — 5y

Answer this question