Tween not playing on humanoid died

Can you show your entire script?

local TweenService = game:GetService("TweenService")
local players = game:GetService("Players")
local map = workspace:FindFirstChild("Map")
local partt = map:FindFirstChild("Map Rooms"):FindFirstChild("Boiler Room"):FindFirstChild("FogPart")
local frame = game.Lighting.Foggy

--local tween = TweenService:Create(frame, tweenInfo, Goal)
-- array of players currently touching this part
-- manipulated with table.find and table.remove because it's guaranteed not to grow larger than 100 players
local playersTouching = {}



function getPlayerFromRootPart(part)
	return part.Name == "HumanoidRootPart" and game.Players:GetPlayerFromCharacter(part.Parent)
end


		
function onTouch(part)
	if frame.Enabled == false then
		frame.Enabled = true
	end
	local player = getPlayerFromRootPart(part)
	if player ~= players.LocalPlayer then return end
	if table.find(playersTouching, player) then return end 
	table.insert(playersTouching, player)
	TweenService:Create(frame, TweenInfo.new(1), {Size = 10}):Play()
	
	end
	
function onTouchEnded(part)
	local player = getPlayerFromRootPart(part)
	if player ~= game.Players.LocalPlayer then return end
	local index = table.find(playersTouching, player)
	if not index then return end 
	table.remove(playersTouching, index)
	TweenService:Create(frame, TweenInfo.new(2), {Size = 0}):Play()
end


partt.Touched:Connect(onTouch)
	partt.TouchEnded:Connect(onTouchEnded)



local Char = players.LocalPlayer.Character

Char:FindFirstChildOfClass("Humanoid").Died:Connect(function()
	frame.Enabled = false
	TweenService:Create(frame, TweenInfo.new(2), {Size = 0}):Play()
end)
	



Try adding a print after

Char:FindFirstChildOfClass("Humanoid").Died:Connect(function()

to see if the event fires.

If the event fires, it is most definitely part of the tween failing, not the event.

image
Just did that. However the lighting DOES NOT seems to be disabled.

What Class is frame?

30 chaaaaaaaars

image

What class is frame? You just showed the properties…

Frame is BlurEffect as showed in the picture i posted.

local frame = game.Lighting.Foggy

What kind of results are you expecting from the tween?

To be either size 0 or entirely disabled, but none are working.

Is it a Local Script or a Server Script

a localscript found in startercharacter.

Are you getting any errors?
See what prints out when you run this.

Char:FindFirstChildOfClass("Humanoid").Died:Connect(function()
print(frame)
frame.Enabled = false
TweenService:Create(frame, TweenInfo.new(2), {Size = 0}):Play()
end)

I think you should be waiting for the humanoid. I’m not sure. I’ve done a script like this and i had to make a repeat for the humanoid to load.

image
this is what it printed.

I copy-pasted your whole script and it works without any problems. Do you have any other script that might change the BlurEffects’s Size property? Also, can you screenshot the entire output?

local TweenService = game:GetService("TweenService")
local Frame = game.Lighting.Foggy

game.Players.LocalPlayer.CharacterAdded:Wait():WaitForChild('Humanoid').Died:Connect(function()
	Frame.Enabled = false
	TweenService:Create(Frame, TweenInfo.new(2), {Size = 0}):Play()
end)

See if this works.

Ok so this is he conclusion:

  • If you put the script inside of the “StarterCharacterScript”, you can just get the character by using “script.Parent” (I know this isn’t useful to fix the problem but can let you know)

  • I don’t know what is foggy.

  • Last but not least, this script may help: (May help since I don’t know what frame is. I assume that frame is Frame UI and if it is that so why will you put that in Lighting?

local Character = script.Parent
local Frame = game.Lighting.Foggy

Character:WaitForChild("Humanoid").Died:Connect(function()
	Frame.Enabled = true
	TweenService:Create(Frame, TweenInfo.new(2), {Size = 16}):Play()
end)

Foggy is a BlurEffect as shown in an image in the 9th reply. So the “Size” property cannot be an Udim2 value.

ah okkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk