Ad
Log in to vote
0

Welding function occurs to all players?

Asked by 3 days ago

Hi again. I am currently fixing a bug in one of my part weld scripts. What's supposed to happen is this: Upon a server event firing, a part is duplicated from ServerStorage and welded onto the player who fired the event. This, of course, doesn't happen. All players end up getting a part welded to them. Someone please help me with this... I'm about to give up... I would use a local script for both, but I want other players to see the change.

Local script (In a folder in startercharacterscripts)

local puddle = game.Workspace.GooClusterMPE.Puddle
puddle.Touched:Connect(function(touch)
    local plr = game.Players:GetPlayerFromCharacter(touch.Parent)
    local char = touch.Parent
    if plr.Team == game.Teams.Humans then
        local animation = game.Workspace.Anims.Animation
        local animtrack = char.Humanoid:LoadAnimation(animation)
        local sound = game.Workspace.Sound
        char.Humanoid.WalkSpeed = 0
        game.Players.LocalPlayer.Team = game.Teams.Infected
        animtrack:Play()
        local repStore = game:GetService("ReplicatedStorage")
        local Human = touch.Parent
        local sound = game.Workspace.Sound
        sound:Play()
        game.ReplicatedStorage.Transfurs.MPEGoo:FireServer()
        wait(5)
        char.Humanoid.WalkSpeed = 16
    end
end)
game.Players.LocalPlayer.Character.Humanoid.Died:Connect(function(touch)
    local plr = game.Players:GetPlayerFromCharacter(touch.Parent)
    plr.Team = game.Teams.Humans
end)

Server Script (In server script service)

game.ReplicatedStorage.Transfurs.MPEGoo.OnServerEvent:Connect(function(player)
    local char = player.Character
    local messyArmL = game.ServerStorage.MessyLimb:Clone()
    local messyArmR = game.ServerStorage.MessyLimb:Clone()
    local messyLegL = game.ServerStorage.MessyLimb:Clone()
    local messyLegR = game.ServerStorage.MessyLimb:Clone()
    local messyTorso = game.ServerStorage.MessyTorso:Clone()
    local ArmL = char["Left Arm"]
    local ArmR = char["Right Arm"]
    local LegL = char["Left Leg"]
    local LegR = char["Right Leg"]
    local Torso = char["Torso"]

    --Left Arm
    local weldAL = Instance.new("WeldConstraint")
    weldAL.Part0 = ArmL
    weldAL.Part1 = messyArmL
    weldAL.Parent = ArmL
    messyArmL.Position = ArmL.Position
    messyArmL.Orientation = ArmL.Orientation
    messyArmL.Parent = game.Workspace
    messyArmL.Color = Color3.new(1, 1, 1)
    --Right Arm
    local weldRA = Instance.new("WeldConstraint")
    weldRA.Part0 = ArmR
    weldRA.Part1 = messyArmR
    weldRA.Parent = ArmR
    messyArmR.Position = ArmR.Position
    messyArmR.Orientation = ArmR.Orientation
    messyArmR.Parent = game.Workspace
    messyArmR.Color = Color3.new(1, 1, 1)
    --Left Leg
    local weldLL = Instance.new("WeldConstraint")
    weldLL.Part0 = LegL
    weldLL.Part1 = messyLegL
    weldLL.Parent = LegL
    messyLegL.Position = LegL.Position
    messyLegL.Orientation = LegL.Orientation
    messyLegL.Parent = game.Workspace
    messyLegL.Color = Color3.new(1, 1, 1)
    --Right Arm
    local weldRL = Instance.new("WeldConstraint")
    weldRL.Part0 = LegR
    weldRL.Part1 = messyLegR
    weldRL.Parent = LegR
    messyLegR.Position = LegR.Position
    messyLegR.Orientation = LegR.Orientation
    messyLegR.Parent = game.Workspace
    messyLegR.Color = Color3.new(1, 1, 1)
    --Torso
    local weldT = Instance.new("WeldConstraint")
    weldT.Part0 = Torso
    weldT.Part1 = messyTorso
    weldT.Parent = Torso
    messyTorso.Position = Torso.Position
    messyTorso.Orientation = Torso.Orientation
    messyTorso.Parent = game.Workspace
    messyTorso.Color = Color3.new(1, 1, 1)
    --Head
    local NewHead = game.ServerStorage.massproducedgoo:Clone()
    local OldHead = char.Head
    local headweld = Instance.new("Weld")
    headweld.Parent = game.Workspace
    headweld.Part0 = OldHead
    headweld.Part1 = NewHead.Headroot
    NewHead:MoveTo(OldHead.Position)
    NewHead.Parent = game.Workspace
    OldHead.Color = Color3.new(1, 1, 1)

    messyLegL.Transparency = 1
    messyLegR.Transparency = 1
    messyTorso.Transparency = 1
    messyArmL.Transparency = 1
    messyArmR.Transparency = 1
    wait(0.25)
    messyLegL.Transparency = 0.75
    messyLegR.Transparency = 0.75
    wait(0.25)
    messyLegL.Transparency = 0.5
    messyLegR.Transparency = 0.5
    wait(0.25)
    messyLegL.Transparency = 0.25
    messyLegR.Transparency = 0.25
    wait(0.25)
    messyLegL.Transparency = 0
    messyLegR.Transparency = 0
    wait(0.1)
    messyArmL.Transparency = 0.75
    messyArmR.Transparency = 0.75
    wait(0.25)
    messyArmR.Transparency = 0.5
    messyArmL.Transparency = 0.5
    wait(0.25)
    messyArmR.Transparency = 0.25
    messyArmL.Transparency = 0.25
    wait(0.25)
    messyArmR.Transparency = 0
    messyArmL.Transparency = 0
    messyTorso.Transparency = 1
    wait(0.1)
    messyTorso.Transparency = 0.75
    wait(0.25)
    messyTorso.Transparency = 0.5
    wait(0.25)
    messyTorso.Transparency = 0.25
    wait(0.25)
    messyTorso.Transparency = 0
end)

Answer this question