Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Players = game:GetService("Players")
- local RunService = game:GetService("RunService")
- local UserInputService = game:GetService("UserInputService")
- local ReplicatedStorage = game:GetService("ReplicatedStorage")
- local axe = script.Parent
- local chopFolder = workspace.chop
- local player = Players.LocalPlayer
- local mouse = player:GetMouse()
- local equipped
- axe.Equipped:Connect(function()
- equipped = true
- end)
- axe.Unequipped:Connect(function()
- equipped = false
- if cut then
- cut:Destroy()
- end
- end)
- axe.Activated:Connect(function()
- if cut and target:IsDescendantOf(chopFolder) then
- ReplicatedStorage.events.cut:FireServer(target, cut.CFrame)
- end
- end)
- RunService.RenderStepped:Connect(function()
- if equipped then
- target = mouse.Target
- if target and target:IsDescendantOf(chopFolder) and not (target.Name == "cut") then
- if not workspace:FindFirstChild("cut") then
- cut = ReplicatedStorage.cut:Clone()
- cut.Size = Vector3.new(target.Size.X + 0.01, 0.1, target.Size.Z + 0.01)
- cut.Parent = workspace
- end
- cut.CFrame = target.CFrame * CFrame.new(0, target.CFrame:PointToObjectSpace(mouse.Hit.Position).Y, 0)
- elseif cut then
- cut:Destroy()
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement