Weld breaks my character

im trying to weld a part under the player and the change to rotation so that its horizontal but no matter what i do it doesnt rotate AT ALL
https://gyazo.com/e8427278929fcc39d52c4e5a829f921d
heres whats happening, im trying to make it sit at the base of the player and be a ring around them but its vertical no matter what i do to change the rotation or cframe or anything

local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()

local replicatedStorage = game:GetService("ReplicatedStorage")

replicatedStorage.RemoteEvents.NetVFX.OnClientEvent:Connect(function(Net,equipped)
	
	if equipped == true then
		
		local range = Net.Config.Range.Value
		local height = (character:WaitForChild("HumanoidRootPart").Size.Y / 2) + character.Humanoid.HipHeight 
		local offset = CFrame.new(0,-height,0)
		
		local p = replicatedStorage.VFX:WaitForChild("RangeVFX"):Clone()
		p.Name = "Range"
		--p.Material = Enum.Material.ForceField
		--p.Transparency = 0.3
		p.Size = Vector3.new(.3,range * 2,range * 2)
		p.CanCollide = false
		p.CastShadow = false
		p.Anchored = false

		local weld = Instance.new("Weld")
		weld.Part0 = p
		weld.Part1 = character:WaitForChild("HumanoidRootPart")
		weld.Parent = p
		p.Parent = character
		p.CFrame = character:WaitForChild("HumanoidRootPart").CFrame * offset * CFrame.Angles(0,0,math.rad(90))
	else
		if character:FindFirstChild("Range") then
			character:FindFirstChild("Range"):Destroy()
		end
	end
	
	
end)

Yeah, you did the wrong thing here. You can’t change the CFrame of the part directly. To change the CFrame of the part that is welded, you need to modify Weld.C0 and Weld.C1 instead. This will be in object space so you will need to convert it using CFrame:ToObjectSpace().

weld.C0 = weld.Part0.CFrame:ToObjectSpace(weld.Part1.CFrame)
im not super familiar with welds, is this somewhere on the right track?

Yes, it is. You will need to experiment with different CFrames and offsets and you should be good.

this is working for rotating the part, but its teleporting my player and making me phase through the ground

Make the part Massless using p.Massless = true.

1 Like

ahh ty works perfectly, i spent 4 and half hours and it was something that simple ;-; i hate scripting sometimes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.