Making Player Visible for a Cutscene

So, I have some Problems with this Function
It should make the Player Visible in cutscenes but it doesn’t
Note: The Game usually plays in first person.

function MakePlayerVisible()

	local PlayerChar = Player.Character:GetDescendants()
	local character = Player.Character

	for index, descendant in PlayerChar do
		if descendant:IsA("BasePart") then
			if descendant.Name == "HumanoidRootPart" then
				descendant.LocalTransparencyModifier = 1
			elseif descendant:IsA("Accessory") then
				descendant:WaitForChild("Handle").LocalTransparencyModifier = 1
			else
				descendant.LocalTransparencyModifier = 0
			end
		end
	end

end

And this is where it should run;

game.ReplicatedStorage.Basefunc.OpenBunkerdoor.OnClientEvent:Connect(function(PlaceToLoad, BunkerDoor)
	MakePlayerVisible()
	LowerTorso.CFrame = BunkerDoor:WaitForChild("Spawner").CFrame
	HumPart.Anchored = true
	local LoadAnimPlr = Humanoid:LoadAnimation(BunkerDoor:WaitForChild("Anims").PlayerAnim)
	local LoadAnimDoor = Humanoid:LoadAnimation(BunkerDoor:WaitForChild("Anims").DoorAnim)
	LoadAnimDoor:Play()
	LoadAnimPlr:Play()
	Player.Character:WaitForChild("Humanoid").AutoRotate = false
	Player.Character:WaitForChild("OwnCam").Value = true
	task.wait(0.5)
	SoundStore["door open metal"]:Play()
	task.wait(3)
	GetBlackScreen:Play()
	task.wait(1)
	HumPart.Anchored = false
	LoadAnimDoor:Stop()
	LoadAnimPlr:Stop()
	Player.Character:WaitForChild("Humanoid").AutoRotate = true
	Player.Character:WaitForChild("OwnCam").Value = false
	unMakePlayerVisible()
	LowerTorso.CFrame = PlaceToLoad.CFrame
	UnGetBlackScreen:Play()
end)

Thanks!

This should be done in renderstepped
Since each frame updates this value to 1

local RunService = game:GetService("RunService")
RunService.RenderStepped:Connect(function()
	--function
end)

In your case it’s easier to do it this way

local RunService = game:GetService("RunService")

function MakePlayerVisible()

	local PlayerChar = Player.Character:GetDescendants()
	local character = Player.Character

	for index, descendant in PlayerChar do
		if descendant:IsA("BasePart") then
			if descendant.Name == "HumanoidRootPart" then
				descendant.LocalTransparencyModifier = 1
			elseif descendant:IsA("Accessory") then
				descendant:WaitForChild("Handle").LocalTransparencyModifier = 1
			else
				descendant.LocalTransparencyModifier = 0
			end
		end
	end

end

local RS = nil

game.ReplicatedStorage.Basefunc.OpenBunkerdoor.OnClientEvent:Connect(function(PlaceToLoad, BunkerDoor)
	if RS == nil then
		RS = RunService.RenderStepped:Connect(function()
			MakePlayerVisible()
		end)
	end
	LowerTorso.CFrame = BunkerDoor:WaitForChild("Spawner").CFrame
	HumPart.Anchored = true
	local LoadAnimPlr = Humanoid:LoadAnimation(BunkerDoor:WaitForChild("Anims").PlayerAnim)
	local LoadAnimDoor = Humanoid:LoadAnimation(BunkerDoor:WaitForChild("Anims").DoorAnim)
	LoadAnimDoor:Play()
	LoadAnimPlr:Play()
	Player.Character:WaitForChild("Humanoid").AutoRotate = false
	Player.Character:WaitForChild("OwnCam").Value = true
	task.wait(0.5)
	SoundStore["door open metal"]:Play()
	task.wait(3)
	GetBlackScreen:Play()
	task.wait(1)
	HumPart.Anchored = false
	LoadAnimDoor:Stop()
	LoadAnimPlr:Stop()
	Player.Character:WaitForChild("Humanoid").AutoRotate = true
	Player.Character:WaitForChild("OwnCam").Value = false
	unMakePlayerVisible()
	LowerTorso.CFrame = PlaceToLoad.CFrame
	UnGetBlackScreen:Play()
	
	-----------
	RS:Disconnect()
end)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.