LocalTransparencyModifier

So i’m trying to make a mask not visible in first person, I have a script that makes all Things visible in first person, but i need this mask to not be included, I’ve already excluded it from the script that makes stuff visible in first person, now i’m trying to make it INVISIBLE for the client only. Heres what i have

local Tool = script.Parent;
local wear = false
enabled = true
local opened = false
local uses = 0
local player = script:FindFirstAncestorWhichIsA"Player" or game:GetService"Players":GetPlayerFromCharacter(script.Parent.Parent)
local chr = player.Character
local TweenService = game:GetService("TweenService")
local cd = false
function onActivated()
	
	if not enabled  then
		return
	end
	
	local Humanoid = Tool.Parent:FindFirstChild("Humanoid")

	if wear == false and cd == false then

		local anim = script.Parent.Animation
		local a = Humanoid:LoadAnimation(anim)
		a:Play()
		wear = true
		wait(1.4)
		Tool.Handle.a.Transparency = 1
		Tool.Handle.s.Transparency = 1
		Tool.Handle.d.Transparency = 1
		Tool.Handle.f.Transparency = 1
	--	player.PlayerGui.black.Image.BackgroundTransparency = 0
		--player.PlayerGui.black.Image.ImageTransparency = 0
		Tool.Handle.sound1:Play()
		local part = game.ReplicatedStorage.WearMask:Clone() 
		part.Parent = chr
		part.LocalTransparencyModifier = 0.5
		part.a.LocalTransparencyModifier = 0.5
		part.d.LocalTransparencyModifier = 0.5
		part.f.LocalTransparencyModifier = 0.5
		part.s.LocalTransparencyModifier = 0.5

		local weld = Instance.new("Weld",chr)
		weld.Part1 = part
		weld.Part0 = chr:WaitForChild("Head")
		weld.C1 = CFrame.new(0.1, -.2, 0) * CFrame.Angles(0,math.rad(12),0)
		wait(.2)
		
		local tween = TweenService:Create(player.PlayerGui.black.Image, TweenInfo.new(1.3), {BackgroundTransparency = 1})
		tween:Play()
		wait(.1)
		Tool.Handle.Sound:Play()
		wear = true
cd = true
		wait(1)
		
		cd = false


else
	--	wear == true then

		local anim2 = script.Parent.Animation2
		local b = Humanoid:LoadAnimation(anim2)
		b:Play()
		

		wait(1.2)
		Tool.Handle.Sound:Stop()

		Tool.Handle.a.Transparency = 0
		Tool.Handle.s.Transparency = 0
		Tool.Handle.d.Transparency = 0
		Tool.Handle.f.Transparency = 0
		player.PlayerGui.black.Image.BackgroundTransparency = 0
		player.PlayerGui.black.Image.ImageTransparency = 1
		Tool.Handle.sound2:Play()
		chr.WearMask:Destroy()
		wait(.2)
		local tween = TweenService:Create(player.PlayerGui.black.Image, TweenInfo.new(1.3), {BackgroundTransparency = 1})
		tween:Play()
		wear = false
		cd = true

		wait(.3)
		wait(1)
		cd = false


		end
end

function onEquipped()



end

function unEquipped()



end
script.Parent.Activated:connect(onActivated)
script.Parent.Equipped:connect(onEquipped)
script.Parent.Unequipped:Connect(unEquipped)

heres specifically what i have

		part.Parent = chr
		part.LocalTransparencyModifier = 0.5
		part.a.LocalTransparencyModifier = 0.5
		part.d.LocalTransparencyModifier = 0.5
		part.f.LocalTransparencyModifier = 0.5
		part.s.LocalTransparencyModifier = 0.5

		local weld = Instance.new("Weld",chr)
		weld.Part1 = part
		weld.Part0 = chr:WaitForChild("Head")
		weld.C1 = CFrame.new(0.1, -.2, 0) * CFrame.Angles(0,math.rad(12),0)
		wait(.2)

I don’t really know how this works, if someone could point me into the right direction, i’d apreciate that.

1 Like