Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Weld cannot assign C0.Position to vector3?

I want to weld a m1 hitbox to the Player but i get an error saying "Position cannot be assigned to" the script is in ServerScriptService Btw

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Wait()
	wait()
	local Hitbox = game.ReplicatedStorage.Hitbox:Clone()
	local Weld = Instance.new("Weld")
	Weld.Part0 = Hitbox
	Weld.Part1 = player.Character.HumanoidRootPart
	Weld.Parent = Hitbox
	Weld.C0.Position. = Vector3.new(0, 0, 3.5)
	Hitbox.Parent = player.Character
end)

1 answer

Change the C0 instead.

local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")

local Hitbox = ReplicatedStorage.Hitbox

Players.PlayerAdded:Connect(function(player)
	local character = player.Character
	if (character == nil) or (character.Parent == nil) then
		character = player.CharacterAdded:Wait()
	end
	
	local Hitbox = Hitbox:Clone()
	Hitbox.Parent = character
	local Weld = Instance.new("Weld")
	Weld.Parent = Hitbox
	Weld.Part0 = Hitbox
	Weld.Part1 = character.HumanoidRootPart
	Weld.C0 = CFrame.new(0, 0, 3.5) -- basically Vector3.new(0, 0, 3.5)
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.