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

Why my hat Position wont change?

Asked by 4 years ago
Edited 4 years ago

Hi, i want to make a hat that is above my head and when i run my script, the hat is inside my head idk why, heres the script

game.Players.PlayerAdded:Connect(function(player)
    player.CharacterAdded:Connect(function(character)
        local part = Instance.new("Part")
        part.Parent = character.Head
        part.Position = Vector3.new(0,5,0) --heres the problem
        part.Name = "Wat"

        local weld = Instance.new("Weld")
        weld.Parent = part
        weld.Part0 = character.Head.Wat
        weld.Part1 = character.Head
    end)
end)

2 answers

Log in to vote
0
Answered by 4 years ago

Maybe try setting the C0 value of the weld i think idk

weld.C0 = CFrame.new(0, 1, 0)

Will push it up 1 stud i think

Ad
Log in to vote
0
Answered by 4 years ago

Hello. Try using a WeldConstraint instead of a Weld.

game.Players.PlayerAdded:Connect(function(player)
    player.CharacterAdded:Connect(function(character)
        local part = Instance.new("Part")
        part.Parent = character.Head
        part.Position = Vector3.new(0,5,0) --heres the problem
        part.Name = "Wat"

        local weld = Instance.new("WeldConstraint")
        weld.Parent = part
        weld.Part0 = character.Head.Wat
        weld.Part1 = character.Head
    end)
end)

Answer this question