Ad
Log in to vote
0

Why is my part only welding to me when my character first spawns?

Asked by 9 days ago
game.Players.PlayerAdded:connect(function(plr)
    plr.CharacterAdded:connect(function(char)
                local boombox = game.ReplicatedStorage.Models.Assets.Boombox:Clone()
                boombox.CFrame = char:WaitForChild("UpperTorso").CFrame
                local weld = Instance.new("Weld", boombox)
                weld.Part0 = char:WaitForChild("UpperTorso")
                weld.Part1 = boombox
                weld.C0 = CFrame.new(0, 0, 1)*CFrame.fromEulerAnglesXYZ(0, math.pi, math.pi/4)
                local sound = Instance.new("Sound", boombox)
                sound.Name = "Music"
                sound.Volume = .7
                sound.Looped = true
                boombox.Mesh.MeshId = "rbxassetid://" .. shopInfo.RadioSkins[player:WaitForChild("ValuesFolder").Equipped.Radio.Value][2]
                boombox.Mesh.TextureId = "rbxassetid://" .. shopInfo.RadioSkins[player:WaitForChild("ValuesFolder").Equipped.Radio.Value][3]
                boombox.Mesh.Scale = Vector3.new(shopInfo.RadioSkins[player:WaitForChild("ValuesFolder").Equipped.Radio.Value][7], shopInfo.RadioSkins[player:WaitForChild("ValuesFolder").Equipped.Radio.Value][7], shopInfo.RadioSkins[player:WaitForChild("ValuesFolder").Equipped.Radio.Value][7])
                boombox.Parent = char
            end
end)

My boombox welds to me when I first join the game and my character spawns, but every time after that it just moves to my UpperTorso and falls into the oblivion as in it isn't being welded or something? Help appreciated, thanks!

1
You forgot a parenthesis. hiimgoodpack 1378 — 9d
1
Also, learn about variables. hiimgoodpack 1378 — 9d

Hi.

Looks like you're using an ad blocker.

That's fine...

No, it really is.

Just, I mean, we put a lot of work into this site, you know?

It would be really really appreciated if you would turn off your ad blocker for our website...

We tried really hard to make our ads as unobtrusive as possible.

If you really hate ads, would you consider a $2 donation via Patreon?

Here's the link.

We love you. We hope you love us too.

.

..

...

Now back to your regularly scheduled Scripting Helpers....

...

..

.

Answer this question



Ad