Advertisement
DrakerMaker

TouchInterest Detector

Sep 23rd, 2019
262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. function rayCast(Position, Direction, Range, Ignore)
  2. return game:service("Workspace"):FindPartOnRay(Ray.new(Position, Direction.unit * (Range or 999.999)), Ignore)
  3. end
  4. local Player_Size = 1
  5. local Light = Instance.new("SpotLight", owner.Character.HumanoidRootPart)
  6. Light.Color = Color3.new(0, 255, 0)
  7. Light.Range = 25
  8. while game:GetService("RunService").Stepped:wait() do
  9. hitfloor, posfloor = rayCast(owner.Character.HumanoidRootPart.Position, CFrame.new(owner.Character.HumanoidRootPart.Position, owner.Character.HumanoidRootPart.Position - Vector3.new(0, 1, 0)).lookVector, 4 * Player_Size, owner.Character)
  10. if hitfloor then
  11. if hitfloor:FindFirstChildOfClass("TouchInterest") then
  12. Light.Color = Color3.new(255, 0, 0)
  13. end
  14. if hitfloor:FindFirstChildOfClass("TouchInterest") == nil then
  15. Light.Color = Color3.new(0, 255, 0)
  16. end
  17. end
  18. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement