I have a game in which players have a slime whose value is equal to their own name. And has another child value "isSlime" (The object itself is what the player named the slime.) Each object is in the workspace and I want to be able to delete this object with a gui in the players starte gui. I have the gui set up to function on click. And all I have to do is make the code.I just can't figure out how to make sure the script deletes an object with a child value of "isSlime" and a child value of the players specific name "name". Could someone help me figure out how to reference the specific slime and destroy; it on "button" click?
WHAT I'VE WRITTEN AND THINK MAY BE CORRECT SO FAR:
function onButtonClicked() local W = game.Workspace:GetChildren() local HasSlime = true for i = 1, #W do if W[i]:findFirstChild("IsSlime") ~= nil then
end
end
end
end
script.Parent.MouseButton1Click:connect(onButtonClicked)
