#No clue whats wrong.
92 messages · Page 1 of 1 (latest)
ill try it
ok
use FindFirstChild from character
in what context? like a part's .Touched event?
it return if child exist or no
No its just for a monster ai
if Character:FindFirstChild("Humanoid") and Character.Humanoid.Health > 0 then
I want it to check if the players health is above 0
** You are now Level 1! **
Thats what I did, atleast I tried
any pleyear in the game? or does it have a target or something it's passing through
It checks for the closest playuer
then checks if there health is above 0
should be other way around so ima do that
local Humanoid = Player.Character:FindFirstChild("Humanoid")
if Humanoid and Humanoid.Health > 0 then
print("Player's Health is "..Health)
end
This appeared to work
no clue why but It did
Thx
did you have it written exactly like xcosanxc2 did it?
He now doesnt bug out after killing the player
ya
I guess if character.Humanoid then doesnt work
Character.Humanoid works fine if you know the humanoid exists
but character:Find do
Character:FindFirstChild("Humanoid") returns nil if it doesnt have a humanoid
I mean its working now and Im not complaining
yeah but then he doesnt bug out now, no clue like I said
so with what xcosanxc2 wrote, it checks to see if a humanoid exists before actually referencing it and the health property attached to it
I can send the snipit
wait how do I send the script maped on discord
like whats the cmd
thx
local function findClosestPlayerNearby()
local players = game:GetService("Players"):GetPlayers()
local closestPlayer = nil
local closestDistance = math.huge
for _, player in pairs(players) do
local character = player.Character
if character then
if character:FindFirstChild("Humanoid") then
local Health = character.Humanoid.Health
if Health > 0 then
local characterPosition = character.PrimaryPart.Position
local distance = (characterPosition - Root.Position).Magnitude
if distance <= detectionRadius and distance < closestDistance then
closestDistance = distance
closestPlayer = player
end
end
else
closestPlayer = nil
end
else
closestPlayer = nil
end
end
return closestPlayer
end
just do this
local player = game.Players.LocalPlayer
local character = player.Character
local humanoid = character.Humanoid
local rootpart = character.HumanoidRootPart
player.CharacterAdded:Connect(function(newC)
character = newC
humanoid = newC:WaitForChild('Humanoid')
rootpart = newC:WaitForChild('HumanoidRootPart')
end)
he's working with a serverscript
e
you wrote a localscript
sad
post a larger screenshot
cuz it doesnt appear when im veiwing server side to watch the monster move around after I died and death screen shows up
like one that captures more of the screen
Ok so I dont need to worry about it?
yeah
my studio shows it differently
do you have CharacterAutoLoads set to false?
maybe you destroyed humanoid
I have it set to 10000000
CharacterAutoLoads is on false
So It can handle the loading of the game better
Cuz after u die the spectate script still detects the character
so I could just make a dead r not value
Wait no
character autoloads is on true
Im gunan put it on false and see if it bothers me
** You are now Level 2! **
Still doesnt fix it so idc
Just anoying and I didnt wana flood the output
Ik what happened