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

How to weld mesh parts without having to use a tool?

Asked by 6 years ago
local players = game.Players.LocalPlayer
local character = players.Character
local Torso = character:FindFirstChild("UpperTorso") or character:WaitForChild("UpperTorso")
local Coat = script.Parent.Parent.CoatMesh

Coat.CFrame = Torso.CFrame * CFrame.new(0,-1.5,1)
local weld = Instance.new("Weld")
weld.Parent = script.Parent
weld.Part0 = Coat
weld.C0 = Coat.CFrame:inverse()
weld.Part1 = Torso
weld.C1 = Torso.CFrame:inverse()
Coat.Anchored = false

This works when its inside a Tool, but I want it welded to my torso at all times without a tool. Here's how it looks currently https://imgur.com/a/pKAvclt

0
glue it to the players back awesomeipod 607 — 6y
0
Local scripts don't run in workspace. 522049 152 — 6y
0
Its not inside a local script. nicktooner 119 — 6y
0
You can't use local player inside a server script. 522049 152 — 6y
View all comments (2 more)
0
How can I get a specific player without using Local Player? I tried using PlayerAdded but that didn't work either :/ nicktooner 119 — 6y
0
Look at answer. 522049 152 — 6y

1 answer

Log in to vote
0
Answered by
522049 152
6 years ago
game.Players.PlayerAdded:Connect(function(player)
    player.CharacterAdded:Connect(function(char)
        local Torso = char:WaitForChild("UpperTorso")
        local Coat = script.Parent.Parent.CoatMesh
        Coat.CFrame = Torso.CFrame * CFrame.new(0,-1.5,1)
        local weld = Instance.new("Weld")
        weld.Parent = script.Parent
        weld.Part0 = Coat
        weld.C0 = Coat.CFrame:inverse()
        weld.Part1 = Torso
        weld.C1 = Torso.CFrame:inverse()
        Coat.Anchored = false
    end)
end)
Ad

Answer this question