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

Why wont this work?

Asked by 8 years ago

It does work but it doesnt stay on the players head...

local Button = script.Parent:WaitForChild("Button")
local HockeyMask = game.ReplicatedStorage.ShopObjects.Masks.HockeyMask
local Player = game.Players.LocalPlayer
Button.MouseButton1Click:connect(function()
if Button.Text == "Mask: Off" then
Button.TextColor3 = Color3.new(85/255, 255/255, 0)
Button.Text = "Mask: On"
local Hat = Instance.new("Hat", Player.Character)
Hat.Name = "HockeyMask"
Hat.AttachmentForward = Vector3.new(0, 0.989, -0.147)
Hat.AttachmentPos = Vector3.new(0, -0.5, 0.48)
Hat.AttachmentRight = Vector3.new(1, 0, 0)
Hat.AttachmentUp = Vector3.new(0, 0.147, 0.989)
local Mask = Instance.new("Part", game.Workspace)
Mask.BrickColor = BrickColor.new("Institutional white")
Mask.Name = "Handle"
Mask.Parent = Player.Character
Mask.Position = Player.Character.Head.Position
Mask.Anchored = true
Mask.CanCollide = false
Mask.Size = Vector3.new(1, 0.4, 1)
local Mesh = Instance.new("SpecialMesh", Mask)
Mesh.MeshId = "http://www.roblox.com/asset/?id=5158270"
Mesh.TextureId = "http://www.roblox.com/asset/?id=5158267"
Mesh.Scale = Vector3.new(0.13, 0.13, 0.1)
end
end)

1 answer

Log in to vote
0
Answered by 8 years ago

You need to weld it. After making the hat, do this:

local weld = Instance.new("Weld",Player.Character.Head)
weld.Name = Hat.Name.. "Weld"
weld.Part0 = Player.Character.Head
weld.Part1 = Mask
Ad

Answer this question