Hello everyone ! So to situate you, I'm trying to make sure that with my tool, here my pick to destroy shares in zones and so when the player touches one of the zones, the share is destroyed and reappears 5s later. But when I test it, it works but only for Zone1 and even if I do it for the others, it's always the same one that gets destroyed, why?
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ss = game:GetService("ServerStorage")
local remoteEvent = ReplicatedStorage:WaitForChild("hitPickaxe")
local zone1 = game.Workspace:WaitForChild("Zone1")
local zone2 = game.Workspace:WaitForChild("Zone2")
local zone3 = game.Workspace:WaitForChild("Zone3")
local function onCreatePart(player)
print(player.Name .. " fired the remote event")
game.Workspace.Rock1:Destroy()
wait(5)
ss:WaitForChild("Rock1"):Clone().Parent = game.Workspace
end
local function onCreatePart2(player)
print(player.Name .. " fired the remote event")
game.Workspace.Rock2:Destroy()
wait(5)
ss:WaitForChild("Rock2"):Clone().Parent = game.Workspace
end
local function onCreatePart3(player)
print(player.Name .. " fired the remote event")
game.Workspace.Rock3:Destroy()
wait(5)
ss:WaitForChild("Rock3"):Clone().Parent = game.Workspace
end
local function pa1(player)
zone1.Touched:Connect(onCreatePart(player))
end
local function pa2(player)
zone2.Touched:Connect(onCreatePart2(player))
end
local function pa3(player)
zone3.Touched:Connect(onCreatePart3(player))
end
if zone1.Touched then
remoteEvent.OnServerEvent:Connect(pa1)
elseif zone2.Touched then
remoteEvent.OnServerEvent:Connect(pa2)
elseif zone3.Touched then
remoteEvent.OnServerEvent:Connect(pa3)
end

2 comments
I'm not sure I understand the logic your script is trying to work with. I assume you're trying to run different functions according to the different zones that may be touched? What is the purpose of the remote here?
@ankurbohra04 In fact, my tool only activates in this area and when the player activates it 5 times, it activates the remote event to destroy the rock.