Hi!
How i can get player character in event PlayerRemoving ?
I have tried to get humanoid on character, but when I try to use it
there is an error at humanoid doesn’t exists
then how do I get player character before player will actually got remove?
Thanks and sorry for bad english.
1 Like
Uhh, when i try to use it there are error at Humanoid doesn’t exists.
posatta
(pasta)
August 6, 2020, 2:03pm
#4
You don’t. The character is gone if they’re leaving.
3 Likes
Then how i can get character before it gone?
posatta
(pasta)
August 6, 2020, 2:04pm
#6
You can’t predict if the player is going to leave soon. What are you trying to do? What’s your usecase?
2 Likes
Syclya
(zzz)
August 6, 2020, 2:05pm
#7
Players.PlayerRemoving:Connect(function(Player)
local Character = Player.Character
if Character then
local Humanoid = Character:FindFirstChild('Humanoid')
if Humanoid then
print('hello')
end
end
end)
1 Like
I’m trying to do a combat system
I trying to find ObjectValue on humanoid
Syclya
(zzz)
August 6, 2020, 2:05pm
#9
That is false, I tested this.
…
Syclya
(zzz)
August 6, 2020, 2:08pm
#11
The code I provided should be your solution.
posatta
(pasta)
August 6, 2020, 2:09pm
#12
I ran that code (in Studio) and it didn’t print a thing because the Character is gone when they’re leaving.
3 Likes
Syclya
(zzz)
August 6, 2020, 2:09pm
#13
Works fine in studio, perhaps this is a bug.
Syclya
(zzz)
August 6, 2020, 2:10pm
#15
In that case, store the player in a table so you can access the instance when they’re leaving.
but we can’t know when player’ll leaving…
Syclya
(zzz)
August 6, 2020, 2:12pm
#17
Use the event, then access the table.
How ? I don’t understand?
I understand as
store character everytime it added
we can’t because we don’t know when objectvalue will got added.
Syclya
(zzz)
August 6, 2020, 2:13pm
#19
You can detect this by using __newindex, which is requiring a metatable.
Uhh, sorry i didn’t learning about it yet.