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

Why Does FireServer Fire Twice? [SOLVED]

Asked by 2 years ago
Edited 2 years ago
--Local Script
function swinging()
    local anim = plr.Character.Humanoid:LoadAnimation(script.QuickSwing)
    anim:Play()
    anim:GetMarkerReachedSignal("HurtboxStart"):Wait()
    print("Found it")
    attEvent:FireServer("HurtStart")
    anim.Stopped:Wait()
    attEvent:FireServer("HurtEnd")
end

--Server Script
event.OnServerEvent:Connect(function(plr, name)
    print("Test")
    if name == "HurtStart" then
        storedSpeed = plr.Character.Humanoid.WalkSpeed
        plr.Character.Humanoid.WalkSpeed = 3

        hurtActive = true
        hit = nil
        hurtCheck(plr)
    elseif name == "HurtEnd" then
        hurtActive = false
        plr.Character.Humanoid.WalkSpeed = storedSpeed
    end
end)

Okay. I really don't understand what's going on here. For some reason when I attempt to fire the server the script fires the server twice. The "Found it" prints once, indicating that it only fires it once but for some reason the OnServerEvent triggers twice each time it's called. So what should print "Test" twice gives me "Found it" once and then "Test" fours times. I've tested this by completely removing everything except the print("Test") from the server script and it's just the same result. I can't tell if this is a coding error or just a roblox bug because I'm essentially being told I'm getting the results of two completely different scenarios.

2
Check if you've duplicated the ServerScript by accident MarkedTomato 810 — 2y
0
Post that as an answer so I can mark that as an answer because that was exactly the issue. I forgot to actually disable and setup the script to reenable in the model changer. XxTrueDemonxX 362 — 2y
0
@XxTrueDemonxX you can also write [SOLVED] in the title to mark it as solved Benbebop 1049 — 2y
0
I would've liked to credit the person but very well XxTrueDemonxX 362 — 2y

Answer this question