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

How can I fix this connection error on my welding script for my vest?

Asked by 4 years ago

I made a vest and I am trying to attach it and weld it to the player's uppertorso but i keep getting this error that says "Flak Jacket:4: Expected '(', '{' or <string>, got ':'".

I thought I wasn't doing anything wrong but that happened, here's my script. Pay Attention to the "playeradded connect" part.

local Lighting = game.Lighting
local Vest = Lighting:WaitForChild("Flak Jacket")

game.Players:PlayerAdded:Connect(function(player)
    player.CharacterAdded:connect(function(character)
        character:WaitForChild("UpperTorso")

        local ClonedVest = Vest:Clone()
        ClonedVest.Parent = character

        ClonedVest:SetPrimaryPartCFrame(character:WaitForChild("UpperTorso").CFrame)
        local Weld = Instance.new("Weld")
        Weld.Part0 = ClonedRH.Main
        Weld.Part1 = character:WaitForChild("UpperTorso")
        Weld.Parent = character:WaitForChild("UpperTorso")
    end)
end)

1 answer

Log in to vote
1
Answered by 4 years ago

On line 4, You put game.Players:PlayerAdded:Connect(function(player), Which is wrong you are supposed to put game.Players.PlayerAdded:Connect(function(player). Please do some research before asking next time.

0
sorry i got confused Fxding_cam 60 — 4y
0
It's alright Trading_Opportunity 191 — 4y
Ad

Answer this question