Reactor4

Peli

Jan 26th, 2021 (edited)
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.91 KB | None | 0 0
  1. local part = script.Parent
  2.  
  3. local l = game.Lighting
  4.  
  5. local function onPartTouched(otherPart)
  6.     -- Get the other part's parent
  7.     local partParent = otherPart.Parent
  8.     -- Look for a humanoid in the parent
  9.     local humanoid = partParent:FindFirstChildWhichIsA("Humanoid")
  10.     if humanoid then
  11.         if l.NormalCC then
  12.             l.NormalCC:Destroy()
  13.         end
  14.         if l.SunRays then
  15.             l.SunRays:Destroy()
  16.         end
  17.        
  18.         local waterThing1 = l.WaterPP.WaterCC:Copy()
  19.         local waterThing2 = l.WaterPP.WaterDOF:Copy()
  20.         waterThing2.Parent = l
  21.         waterThing1.Parent = l
  22.     end
  23. end
  24.  
  25. local function onPartTouchEnded(otherPart)
  26.     if l.WaterDOF then
  27.         l.WaterDOF:Destroy()
  28.     end
  29.     if l.WaterPP then
  30.         l.WaterPP:Destroy()
  31.     end
  32.    
  33.     local normalThing1 = l.NormalPP.SunRays
  34.     local normalThing2 = l.NormalPP.NormalCC
  35.     normalThing1.Parent = l
  36.     normalThing2.Parent = l
  37. end
  38.  
  39. part.TouchEnded:Connect(onPartTouchEnded)
  40.  
  41. part.Touched:Connect(onPartTouched)
Add Comment
Please, Sign In to add comment