How can I hit my rock multiple times until it breaks, instead of just once? And how do I make it move?

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I want to make a rock target move when hit and after a few hits, destroy it temporarily

  2. What is the issue? Include screenshots / videos if possible!
    I can only make it so if it hits once, not multiple times, and it’s bugged

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I tried fiddling with my script so that It moves back and forth, but it doesn’t work.

local player = game.Players.LocalPlayer
local Mouse = player:GetMouse() -- We need to get mouse (only in local script)
local Tool = script.Parent
local db = false

local ss = game.ReplicatedStorage["Small Stone"]
local bs = game.ReplicatedStorage["Big Stone"]

local startPosition = Vector3.new(-1, 0, 0)
local endPosition = Vector3.new(2, 0, 0)

Tool.Activated:Connect(function()
	local Target = Mouse.Target 
	if Target then -- check if it exists
		if Target.Name == "Rock" then -- checks the name
			local Distance = (player.Character.HumanoidRootPart.Position-Target.Position).Magnitude 
			if Distance < 15 then -- Checks if plyer is close
				if db == false then
					db = true
					wait(1)
					ss:Clone().Parent = player:FindFirstChild("Backpack")
					bs:Clone().Parent = player:FindFirstChild("Backpack")
					ss:Clone().Parent = player:FindFirstChild("Backpack")
					bs:Clone().Parent = player:FindFirstChild("Backpack")
					Target.Position = startPosition
					Target:MoveTo(startPosition)
					wait(1)
					Target.Position = endPosition
					Target:MoveTo(endPosition)
					Target.Parent.Parent = nil
					wait(900)
					Target.Parent.Parent = workspace
					db = false
				end
			end
		end
	end
end)

You can make it so that whenever the rock gets hit, add like a variable that indicates how many times the rock gets hit, also you should do this in a server script.

I have thought of that. I won’t do it on a Script tho, I want only the player who broke the stone to see it dissapear. Also, I’d have to rewrite some scripts if I wanna change them into Server scripts

Will the stone be visible to everyone?

if I change the script to server-side, I’m worried that everyone will see the stone dissapear… (also, I’d have to rewrite some stuff)

Well no worries, you can make it so that the damage dealing part is on the client. For example, let’s say the rock has 500 hitpoints, Player A beats it and it will ONLY SHOW 400 hitpoints on Player A’s screen and it will not show the 400 hitpoints on other players.

I don’t know how to change the script (It has to somehow be in the tool) to a server-sided script. If I was to script it, it would not work anymore and I’d have a hard time knowing what to change.

Just make the tool fire a ray whenever you click while holding the tool, then you check if the part that the ray hit, has a number value called, for example “Strength”. If it does, lower the value of that value by a certain amount, then check if the part exists, it if it does, then check whenever the value changes, it the new value is 0 or under, delete the part, and or do something else. All of this can be done inside of the tool, I know that because I have done this exact thing for a mining mechanic for one of my games.