Advertisement
beati_kay

axe server script 3

May 8th, 2024
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.02 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 = target:Clone()
  12.     lowerPart.Size = Vector3.new(target.Size.X, (bottom.Position - cutCFrame.Position).Magnitude, target.Size.Z)
  13.     lowerPart.CFrame = cutCFrame * CFrame.new(0, cutCFrame:PointToObjectSpace(bottom.Position).Y / 2, 0)
  14.    
  15.     local upperPart = target:Clone()
  16.     upperPart.Size = Vector3.new(target.Size.X, (top.Position - cutCFrame.Position).Magnitude, target.Size.Z)
  17.     upperPart.CFrame = cutCFrame * CFrame.new(0, cutCFrame:PointToObjectSpace(top.Position).Y / 2, 0)
  18.    
  19.     upperPart.Parent = target.Parent
  20.     lowerPart.Parent = target.Parent
  21.     target:Destroy()
  22. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement