Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Humanoid.Died and Humanoid.HealthChanged not working with FE?

The scripts are inside a model while that model is inside Workspace. I don't think it's the location but rather how it's getting fired.

I'm trying to use Humanoid.Died:connect() along with Humanoid.HealthChanged:connect() but they seem to not want to work?

I looked at the wiki but it doesn't say anything about this.

Edit -----------------------------------------

Script 1

local cash = script.Parent.Config.Cash.Value
local xp = script.Parent.Config.Exp.Value
local Humanoid = script.Parent.NPCoid

function Died() 
	local tag = Humanoid:findFirstChild("creator") 
	if tag ~= nil then 
		if tag.Value ~= nil then 
			local find = tag.Value:findFirstChild("InParty")
			local Leaderstats = tag.Value:findFirstChild("Stats") 
			if Leaderstats ~= nil then
				local player = tag.Value
				if player ~= nil then
					if player.InParty.Value == "" then
						print("Alone!")
						local Bonus = Leaderstats.Bonus
						Leaderstats.XP.Value = math.floor((Leaderstats.XP.Value + (cash*(Bonus.Value/100))))
						Leaderstats.Gold.Value = math.floor((Leaderstats.Gold.Value + (cash*(Bonus.Value/100))))
						if player:findFirstChild("Quests").Quest1 ~= nil then
							player.Quests.Quest1.Total_Kills.Value = player.Quests.Quest1.Total_Kills.Value + 1
						end
						wait(0.1)
						script:Destroy()
					else
						print("InParty!")
						local party = game.Lighting.Party:findFirstChild(player.InParty.Value)
						local RewardParty = party:GetChildren()
						for i = 1, #RewardParty do
							local PartyMember = game.Players:findFirstChild(RewardParty[i].Name)
							print(PartyMember)
							if PartyMember:findFirstChild("Quests").Quest1 ~= nil then
								PartyMember.Quests.Quest1.Total_Kills.Value = PartyMember.Quests.Quest1.Total_Kills.Value + 1
							end
							local leaderstat = PartyMember:findFirstChild("Stats")
							print(leaderstat.Parent)
							local Bonus = leaderstat.Bonus
							leaderstat.XP.Value = math.floor((leaderstat.XP.Value + ((cash*(Bonus.Value/100)/#RewardParty))))
							leaderstat.Gold.Value = math.floor((leaderstat.Gold.Value + ((cash*(Bonus.Value/100)/#RewardParty))))
							script:Destroy()
						end
					end
				end
			end 
		end 
	end 
end 
Humanoid.Died:connect(Died) 

Script2

robo = script.Parent:clone()
NP = script.Parent.NPCoid
health = script.Parent.NPCoid.Health
mhealth = script.Parent.NPCoid.MaxHealth
name = script.Parent
lvl = script.Parent.Config.Level.Value
name.Name = "Level: "..lvl.." NPC - "..health.."/"..mhealth

NP.HealthChanged:connect(function (health)
	name.Name = "Level: "..lvl.." NPC - "..health.."/"..mhealth
	local x = script.Parent
	if x ~= nil then
		if script.Parent.NPCoid.Health < 1 then
			local robot = robo:clone()
			robot.Parent=script.Parent.Parent
			robot:makeJoints()
			robot.NPCoid.Health = robot.NPCoid.MaxHealth
			wait(0.01)
			script.Parent:remove()
		end
	end
end)	

2 comments

0

What exactly is going on? Are you getting any errors? What exactly are you trying to do? Please explain more, you gave barely any information

0

No errors, nothing. Here, let me do an edit and show you the 2 scripts that aren't working the thing is though, nothing happens at all..

1 answer

Even with FilteringEnabled, things like the player's character are fully controlled by the client (unless you specifically set the player's model to be owned by the server - but this would probably disable animation, and probably movement too). Thus, these events could very well be just be staying on the client. You'll have to listen for the events using a LocalScript and then, via a RemoteEvent, send the data to the server.

This discussion is preserved as it was. New answers, comments, and votes are closed.