Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How can I make choppable trees in Roblox Studio?

Asked by 2 years ago
So I've been trying for a few days to make trees in my survival game able to be chopped down, but I haven't gotten any luck. I've also been using free realistic models for trees because I don't know the first thing about modeling. I've been using this local script in StarterCharacterScripts and I don't really know what to do at this point. I also want to make sure that when any tree is chopped, after about like 0.5 seconds, the tree disappears and is completely untouchable, which I can't really do if the tree can't fall in the first place. Thank you to anyone who might be reading this.

local player = game.Players.LocalPlayer local mouse = player:GetMouse() local camera = workspace.CurrentCamera local RunService = game:GetService("RunService") local target local down local WalkKey = "MouseButton1Click" local PlayerModel = workspace:WaitForChild(player.Name,1)

game:GetService("UserInputService").InputBegan:Connect(function(inputObject, gameProcessedEvent) if inputObject.KeyCode == Enum.KeyCode[WalkKey] then if mouse.Target.Name == "Trunk" then

        if PlayerModel.Hatchet then
            mouse.Target.Weld:Destroy()
            mouse.Target.Name = "Welded"

            if mouse.Target ~= nil and mouse.Target.Locked == false then -- extra
            end
        end
    end     
end     

end)

0
Dont think I fixed things but MouseButton1Click isnt an event of Mouse which Im guessing is why your Enum.KeyCode didnt work also you dont need Enum.KeyCode for mouse in this instance I dont think just use Mouse.Button1Down:Connect Bloxerventure 5 — 2y
0
Dont think I fixed things but MouseButton1Click isnt an event of Mouse which Im guessing is why your Enum.KeyCode didnt work also you dont need Enum.KeyCode for mouse in this instance I dont think. just use Mouse.Button1Down:Connect sorry if i didnt help im still in the works of scripting Bloxerventure 5 — 2y

Answer this question