Why is the model empty?

hello,

so i have a game and in that game there is a dead bush.
now i want the dead bush to respawn after players destroyed it for resources but it doesn’t respawn.
when i went to check what’s wrong, the code looked fine.
so i had it print the exact moments and even checked if the model had spawned.
when i went to go check i saw that the model was spawned, but it was empty…
why?
picture of problem:
Empty Model
here is the script:

local Bushes = script.Parent.Parent.Bushes
local Pos = Bushes.Bush.MAIN.Position

Bushes.ChildRemoved:Connect(function(child)
	print("Ran")
	task.wait(60)
	print("Awaited")
	local Bush = game.ServerStorage.Bush:Clone()
	Bush.Parent = script.Parent.Parent--forgor to add .Bushes just ignore :)
	Bush:PivotTo(CFrame.new(Pos))
end)

so any way how to fix this?
i’ve already tried restarting rblx studio but that doesn’t seem to help…

Thanks in advance!

4 Likes

There isn’t really enough information here to diagnose the problem.

What other code to have that modifies Bush?

3 Likes

the bush itself does not contain any scripts, but it can be destroyed by the script of a player’s tool.
the bush contains only two attributes which say health and drops but that’s it.
so i really don’t know what is wrong

2 Likes

Send the code that destroys the Bush. I suspect the problem is over there.

3 Likes

this is a sample of the touched event for the player’s tool:

Folder.Hammer.Touched:Connect(function(hit)
	if not IsHitting then return end
	if hit.Parent == Character then return end
	if not hit:GetAttribute("Health") then return end
	hit:SetAttribute("Health",hit:GetAttribute("Health") - Damage)
	Tool:SetAttribute("Durability",Durability - 1)
	Durability = Tool:GetAttribute("Durability")
	IsHitting = false
	HitSFX:Play()
	if hit:GetAttribute("Health") <= 0 then
		if hit.Parent:IsA("Model") then
			--Code which chooses drops
			hit.Parent:Destroy()
		       --Rest of code which drops the items...
		else
			hit:Destroy()
		end
	end
end)
1 Like

Hm, the Bush in game.ServerStorage.Bush is most like empty. If in Studio it is not then there is some script clearing its children.

add this line

local Bush = game.ServerStorage.Bush:Clone()
print(#Bush:GetDescendant()) -- add this line

If that prints 0, then you know the Bush in ServerStorage is empty. If it is more than 0 than there is something else clearing the descendants of the cloned Bush.

1 Like

Schermopname (224)
this is the output, there are no scripts which are supposed to clear the model so i don’t know what’s causing it…

Last thing I can think of is the parts of the Bush are unanchored and falling out of the world. Make sure they are Anchored.

1 Like

they’re anchored :frowning:
i don’t know what is wrong

You’re going to have to trace what is destroying the descendants

Bush.DescendantRemoving:Connect(function()
   print(debug.traceback())
end)

the event never runs, so the server thinks no descendants are being cleared?!

Yeah, I can’t help you further unless I had a place file or something and can inspect it myself. Good luck.

Are you able to add a print statement after defining Bush and after parenting Bush.

If the event never runs, then it is likely that no object is being destroyed on the server.

Is the script in the player’s tool a local script or a script (the script that destroys the bush)?

If it’s a local script, then make it a server script since client side effects don’t replicate onto the server.

for anyone who just arrived, i’ve opened a new place and started to slowly copy paste everything from the first to the second place, every time i pasted something i tested if the bush still works.
at the beginning it worked and eventually i added everything!
(sike otherwise i wouldn’t be here)
when i went ahead and added the last item,
it broke.
that item was a script.
this to be exact:

local L = game.Lighting
local Days = 0

game.Players.PlayerAdded:Connect(function(plr)
	local Connection = nil
	task.wait(5)
	local Folder = game.ServerStorage.Islands
	local IslandNumber = math.random(1,#Folder:GetChildren())
	local Island = Folder.Island3:Clone() --Folder:GetChildren()[IslandNumber]:Clone()
	Island.Parent = workspace
	local Position = Vector3.new(math.random(1,10000),50,math.random(1,10000))
	Island:PivotTo(CFrame.new(Position))
	plr.Character.PrimaryPart.Position = Island.Start.Position
	Island.Name = plr.Name.."'s Island!"
	plr.CharacterRemoving:Connect(function(char)
		task.wait(0.1)
	   plr.Character.PrimaryPart.Position = Island.Start.Position
	end)
end)

game.Players.PlayerRemoving:Connect(function(plr)
	local Island = workspace:FindFirstChild(plr.Name.."'s Island")
	if not Island then return end
	Island:Destroy()
end)

while wait(20) do
	L.ClockTime += 1
end

i’ve narrowed the problem down from, the entirety of game to this.
i still don’t know what line causes this, if a copy of the island3 is already in the game the island3 model that get’s spawned will also break but the bush on the first island will work.
if there is no copy of island3 already in the game, the spawned island3 will work but the bush breaks.
now keep in mind , the pre made copy and the model in ServerStorage are the same, since i’ve pressed ctrl+c + ctrl+v

Again, thanks in advance!

kkkkkkkkkkkkkkkkkkkkkk it is a server script (ignore the ‘k’ it was to get this comment over 30 so i could respond)