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

Why can't I send a string value to the server with remote event?

Asked by 3 years ago
Edited 3 years ago

This is part of a fighting Local Script (First Script), this part use a Remote Event to let a Server Script (Second Script) make damage and these thing.

The problem is that when I send RightHand and I print it in the Server Script it is nil.

Something to add is that in Local Script when I print ye it doesn't print it.

local Hit = function(hand, hit)

    if hand == "RightHand" then

        if canHit.RightHand == true then

            canHit.RightHand = false

            pcall(function()

                if hit.Parent.Humanoid then

                    script.Hit:FireServer(hit, false, "RightHand")

                    print("ye")

                end

            end)

        end

    elseif hand == "LeftHand" then

        if canHit.LeftHand == true then

            canHit.LeftHand = false

            pcall(function()

                if hit.Parent.Humanoid then

                    script.Hit:FireServer(hit, false, "LeftHand")

                    print("ye2")

                end

            end)

        end

    elseif hand == "RightLeg" then

        if canHit.RightLeg == true then

            canHit.RightLeg = false

            pcall(function()

                if hit.Parent.Humanoid then

                    script.Hit:FireServer(hit, false, "RightLeg")

                    print("ye3")

                end

            end)

        end

    elseif hand == "LeftLeg" then

        if canHit.LeftLeg == true then

            canHit.LeftLeg = false

            pcall(function()

                if hit.Parent.Humanoid then

                    script.Hit:FireServer(hit, true, "LeftLeg")

                    print("ye4")

                end

            end)

        end

    end

end

This is part of the Server Script and when I print AnimationType, it prints nil


script.Parent.OnServerEvent:Connect(function(plr, hit, knockBack, AnimationType) isProtecting = hit.Parent.MainAbilities:GetAttribute("IsProtecting") print(hit) print(knockBack) print(AnimationType) if AnimationType == "RightHand" then hitAnimLoaded = hit.Parent.Humanoid:LoadAnimation(hitAnim.FrontRight) if isProtecting == false then hitAnimLoaded:Play() end end

Answer this question