Advertisement
beati_kay

axe server script 2

May 7th, 2024
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.23 KB | None | 0 0
  1. local ReplicatedStorage = game:GetService("ReplicatedStorage")
  2.  
  3. local events = ReplicatedStorage.events
  4. local cutEvent = events.cut
  5.  
  6. cutEvent.OnServerEvent:Connect(function(player, target, cutCFrame)
  7.     print(player, "chopped", target)
  8.     local top = target.CFrame * CFrame.new(0, target.Size.Y / 2, 0) * CFrame.Angles(math.pi / 2, 0, 0)
  9.     local bottom = target.CFrame * CFrame.new(0, target.Size.Y / -2, 0) * CFrame.Angles(math.pi / -2, 0, 0)
  10.    
  11.     local lowerPart = Instance.new("Part", target.Parent)
  12.     lowerPart.Name = target.Name
  13.     lowerPart.BrickColor = BrickColor.new("Really red")
  14.     lowerPart.Anchored = target.Anchored
  15.     lowerPart.Size = Vector3.new(target.Size.X, (bottom.Position - cutCFrame.Position).Magnitude, target.Size.Z)
  16.     lowerPart.CFrame = target.CFrame * CFrame.new(0, cutCFrame:PointToObjectSpace(bottom.Position).Y, 0)
  17.    
  18.     local upperPart = Instance.new("Part", target.Parent)
  19.     upperPart.Name = target.Name
  20.     upperPart.BrickColor = BrickColor.new("Really blue")
  21.     upperPart.Anchored = target.Anchored
  22.     upperPart.Size = Vector3.new(target.Size.X, (top.Position - cutCFrame.Position).Magnitude, target.Size.Z)
  23.     upperPart.CFrame = target.CFrame * CFrame.new(0, cutCFrame:PointToObjectSpace(top.Position).Y, 0)
  24.    
  25.     target:Destroy()
  26. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement