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

why doesnt my even not fire when i click a button?

Asked by 6 years ago

im new to FE and dont know whats wrong with my code, itonly prints up to "stepped 2 reached" there is no output error local script;

local pleyr = game:GetService("Players")
repeat wait() until game.Players.LocalPlayer and game.Players.LocalPlayer.Character

script.Parent.MouseButton1Click:connect(function()
    print("button has been pressed")
    local plyr = game.Players.LocalPlayer.Character
    print("step1Reached")
    local upperLarm = plyr:WaitForChild("LeftUpperArm")
    local upperRarm = plyr:WaitForChild("RightUpperArm")
    local chest = plyr:WaitForChild("UpperTorso")
    local lowerchest= plyr:WaitForChild("LowerTorso")
    local cloneuperrLarm = game.ReplicatedStorage.BlueChestPiece.ArmourLeftArm:Clone()
    local cloneupperRarm =game.ReplicatedStorage.BlueChestPiece.UpperRightArm:Clone()
    local cloneuppertorso =game.ReplicatedStorage.BlueChestPiece.Chest.Chest:Clone()
    local clonelowertorso =game.ReplicatedStorage.BlueChestPiece.Lowerbelly:Clone()
    print("step2Reached")
    game.ReplicatedStorage.BlueChestPiece:WaitForChild("RFArmor"):FireServer(plyr,upperLarm,upperRarm,chest,lowerchest,cloneuperrLarm,cloneupperRarm,cloneuppertorso,clonelowertorso)

end)


serverScript;

local function putonarmour(Player,plyr,upperLarm,upperRarm,chest,lowerchest,
    cloneuperrLarm,cloneupperRarm,cloneuppertorso,clonelowertorso)
    print("reached the event")

        cloneuperrLarm.Parent = plyr
        cloneuperrLarm.PrimaryPart.CFrame = upperLarm.CFrame
        print(cloneuperrLarm.."has been invoked")
        local weld = Instance.new("Weld")

        weld.Part0 = upperLarm
        weld.Part1 = cloneuperrLarm.PrimaryPart

        weld.Parent= plyr


        cloneupperRarm .Parent = plyr
        cloneupperRarm .PrimaryPart.CFrame = upperLarm.CFrame

        local weld = Instance.new("Weld")
        weld.Part0 = upperRarm
        weld.Part1 = cloneupperRarm .PrimaryPart
        weld.Parent= plyr



        cloneuppertorso .Parent = plyr
        cloneuppertorso .PrimaryPart.CFrame = chest.CFrame
        local weld = Instance.new("Weld")
        weld.Part0 = chest
        weld.Part1 = cloneuppertorso.PrimaryPart
        weld.Parent= plyr

        clonelowertorso .Parent = plyr
        clonelowertorso .PrimaryPart.CFrame = upperLarm.CFrame

        local weld = Instance.new("Weld")
        weld.Part0 = lowerchest
        weld.Part1 = clonelowertorso .PrimaryPart
        weld.Parent= plyr
end

script.Parent.RFArmor.OnServerEvent:connect(putonarmour)
0
Why not just clone all the armor from the server script? Just have the local script detect if the user even clicked the button. The issue is that the server and client don't see eye to eye. Since you're creating parts on the client side, the server doesn't see it. It'd be better to create the parts with the server script. M39a9am3R 3210 — 6y
0
i did that, but when i fire the server event nothing happens, the function thats supposed to run prints a when it does, but it doesnt and there is sstill no output error deerdharok 91 — 6y

Answer this question