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

Hat not welding to player's head?

Asked by 8 years ago

I'm trying to change every player's appearance by putting a hat on them when they spawn. However, the script partially works, the only issue being that the hat won't weld to the player's head, and instead the hat that the player is wearing remains with them instead of being cleared from their character.

wait()
Player = game.Players.LocalPlayer
Player.CanLoadCharacterAppearance = false
local BColors = Instance.new("BodyColors")
BColors.Parent = game.Players.LocalPlayer.Character
BColors.HeadColor = BrickColor.new(255,255,255)
BColors.TorsoColor = BrickColor.new(255,255,255)
BColors.LeftArmColor = BrickColor.new(255,255,255)
BColors.LeftLegColor = BrickColor.new(255,255,255)
BColors.RightArmColor = BrickColor.new(255,255,255)
BColors.RightLegColor = BrickColor.new(255,255,255)

local face = game.Players.LocalPlayer.Character.Head:FindFirstChild("face")
face.Texture = "http://www.roblox.com/asset/?id=10747452"
------------------------------------------
--Hat creation--
------------------------------------------
local hat = Instance.new("Hat")
    hat.Parent = game.Players.LocalPlayer.Character
    hat.AttachmentForward = Vector3.new(0,0,-1)
    hat.AttachmentPos = Vector3.new(0,0.29,-0.205)
    hat.AttachmentRight = Vector3.new(1,0,0)
    hat.AttachmentUp = Vector3.new(0,1,0)
    hat.Name = "Helmet"
local hatHandle = Instance.new("Part")
    hatHandle.Parent = hat
    hatHandle.Name = "Handle"
    hatHandle.Size = Vector3.new(1.4,1.6,2)
    hatHandle.CanCollide = true
local hatMesh = Instance.new("SpecialMesh")
    hatMesh.Parent = hatHandle
    hatMesh.MeshId = "http://www.roblox.com/asset/?id=111503081"
    hatMesh.TextureId = "http://www.roblox.com/asset/?id=282686299"
    hatMesh.Scale = Vector3.new(2,2,2)
    hatMesh.Offset = Vector3.new(0,0,0)
    hatMesh.VertexColor = Vector3.new(1,1,1)

Answer this question