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

Weld cannot assign C0.Position to vector3?

Asked by 1 year ago

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

Log in to vote
0
Answered by 1 year ago

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)
Ad

Answer this question