Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local ReplicatedStorage = game:GetService("ReplicatedStorage")
- local events = ReplicatedStorage.events
- local cutEvent = events.cut
- cutEvent.OnServerEvent:Connect(function(player, target, cutCFrame)
- print(player, "chopped", target)
- local top = target.CFrame * CFrame.new(0, target.Size.Y / 2, 0) * CFrame.Angles(math.pi / 2, 0, 0)
- local bottom = target.CFrame * CFrame.new(0, target.Size.Y / -2, 0) * CFrame.Angles(math.pi / -2, 0, 0)
- local lowerPart = Instance.new("Part", target.Parent)
- lowerPart.Name = target.Name
- lowerPart.BrickColor = BrickColor.new("Really red")
- lowerPart.Anchored = target.Anchored
- lowerPart.Size = Vector3.new(target.Size.X, (bottom.Position - cutCFrame.Position).Magnitude, target.Size.Z)
- lowerPart.CFrame = target.CFrame * CFrame.new(0, cutCFrame:PointToObjectSpace(bottom.Position).Y, 0)
- local upperPart = Instance.new("Part", target.Parent)
- upperPart.Name = target.Name
- upperPart.BrickColor = BrickColor.new("Really blue")
- upperPart.Anchored = target.Anchored
- upperPart.Size = Vector3.new(target.Size.X, (top.Position - cutCFrame.Position).Magnitude, target.Size.Z)
- upperPart.CFrame = target.CFrame * CFrame.new(0, cutCFrame:PointToObjectSpace(top.Position).Y, 0)
- target:Destroy()
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement