So basically
When a selected player presses "g" ; they a cheeseblock is confirmed/placed, and I want it so at the eend of hte game ; in server-wide script ; I find in workspace "FinalCheese" and destroy it but its not working
local function confirmCheesePlacement()
if cheesePlaced and lastPlacedBlock then
lastPlacedBlock.Name = "FinalCheese"
local detector = Instance.new("ClickDetector")
detector.MaxActivationDistance = 32
detector.Parent = lastPlacedBlock
detector.MouseClick:Connect(function(playerWhoClicked)
local name = playerWhoClicked.Name
print(name .. " found the cheese!")
Winner:FireServer(name)
end)
if Tool.Parent == Player.Character or Tool.Parent == Player.Backpack then
tool:Destroy()
ConfirmPlacementEvent:FireServer()
end
if previewBlock then
previewBlock:Destroy()
previewBlock = nil
end
print("Cheese block placement confirmed by player!")
else
PlaceGui.Enabled = true
delay(2, function()
PlaceGui.Enabled = false
end)
end
end
^^ Tool Script
print("Scanning for FinalCheese...")
for _, obj in ipairs(workspace:GetDescendants()) do
if obj:IsA("BasePart") and obj.Name == "FinalCheese" then
print("[RoundManager] Destroying FinalCheese block at:", obj:GetFullName())
obj:Destroy()
break
end
end
end
^^ Serverwide Script
The server can't find the "FinalCheese" and destroy it
** You are now Level 4! **