hi i was making a mask
and when i equip it like in 5 second it destroys itself
video:
script:
repeat wait() until script.Parent.Parent:IsA("Model")
local tool = script.Parent
local char = tool.Parent
local hum = char:WaitForChild("Humanoid")
local equip = hum:LoadAnimation(tool:WaitForChild("Anims").Equip)
local UnEquip = hum:LoadAnimation(tool:WaitForChild("Anims").UnEquip)
tool:WaitForChild("MaskEvent").OnServerEvent:Connect(function(plr,bool)
if bool == true then
equip:Play()
task.wait(equip.Length)
char:FindFirstChild("Head").RoleplayName.Frame.RoleplayName.Text = "Masked"
local mask = game:GetService("ReplicatedStorage").Mask:Clone()
mask.Name = "mask"
mask.Parent = char
local weld = Instance.new("Weld",char:FindFirstChild("Head"))
weld.Part0 = char:FindFirstChild("Head")
weld.Part1 = mask
weld.C0 = mask.CFrame:Inverse() * char:FindFirstChild("Head").CFrame
tool:FindFirstChild("Handle").Transparency = 1
for _,v in pairs(char:GetChildren()) do
if v:IsA("Accessory") then
v.Handle.Transparency = 1
end
end
else
local mask = char:FindFirstChild("mask")
if mask then
UnEquip:Play()
task.wait(UnEquip.Length)
char:FindFirstChild("Head").RoleplayName.Frame.RoleplayName.Text = hum.DisplayName.."(@"..plr.Name..")"
mask:Destroy()
for _,v in pairs(char:GetChildren()) do
if v:IsA("Accessory") then
v.Handle.Transparency = 0
end
end
tool:WaitForChild("Handle").Transparency = 0
end
end
end)
please help me and its last day of school so i not gonna be here like 1 hour