Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Taken from default character scripts: "StarterPlayer" -> "PlayerModule" -> "ControlModule" -> "ClickToMoveController"
- local humanoidCache = {}
- local function findPlayerHumanoid(player)
- local character = player and player.Character
- if character then
- local resultHumanoid = humanoidCache[player]
- if resultHumanoid and resultHumanoid.Parent == character then
- return resultHumanoid
- else
- humanoidCache[player] = nil -- Bust Old Cache
- local humanoid = character:FindFirstChildOfClass("Humanoid")
- if humanoid then
- humanoidCache[player] = humanoid
- end
- return humanoid
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement