Advertisement
davidxcgdr

Anti-NaN value

Nov 29th, 2020
294
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.82 KB | None | 0 0
  1. -- put into StarterCharacterScripts
  2.  
  3. HumanoidRootPart = script.Parent:WaitForChild('HumanoidRootPart')
  4. Reason = "NaN value detected."
  5.  
  6. game:GetService("RunService").RenderStepped:Connect(function()
  7.     pcall(function()
  8.         if ((string.lower(tostring(math.abs(HumanoidRootPart.CFrame.X)))) and (string.lower(tostring(math.abs(HumanoidRootPart.CFrame.Y)))) and (string.lower(tostring(math.abs(HumanoidRootPart.CFrame.Z))))) == string.lower("nan") then
  9.             game.Players[script.Parent.Name]:Kick(Reason)
  10.         end
  11.     end)
  12.    
  13.     pcall(function()
  14.         if ((tostring(string.lower(math.abs(HumanoidRootPart.CFrame.X)))) and (tostring(string.lower(math.abs(HumanoidRootPart.CFrame.Y)))) and (tostring(string.lower(math.abs(HumanoidRootPart.CFrame.Z))))) == string.lower("nan") then
  15.             game.Players[script.Parent.Name]:Kick(Reason)
  16.         end
  17.     end)
  18. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement