Hello! I am currently fixing the Welcome to the Town of Robloxia game by 1dev2, since Roblox has made changes to their scripting, and I've run into a little problem. This code:

script.Parent.MouseButton1Click:Connect(function()
	local t = game.Teams[script.Parent.Text]
	script.Parent.Parent.Parent.Parent.Parent.Parent.TeamColor = t.TeamColor
	local spawns = game.Workspace.SpawnLocations:GetChildren()
	for i=1, #spawns do
		if spawns[i].TeamColor == t.TeamColor then
			script.Parent.Parent.Parent.Parent.Parent.Parent.Character:MoveTo(spawns[i].Position + Vector3.new(0,10,0))
		end
	end
	script.Parent.Parent.Parent:Remove()
end)

Everything works fine, apart from line 10. The Background doesn't get removed. Everything else in that block of code works. It's in a LocalScript, in a button. What's suppose to happen is, when you click the button, the black background is suppose to dissapear.

Any help is greatly appreciated. :)

5 comments

0

Any errors? Or a screenshot of the hierarchy? Because Idk what's script.Parent, or script.Parent.Parent or script.Parent.Parent.Parent in your game

2

:Remove() is deprecated, use :Destroy() instead. Also, maybe set the background transparency to 1, or set the black background's parent to a new parent, for example a folder in ReplicatedStorage

0

What @ScrubSadmir said!

0

^^ That should fix it.

0

Also, really, don't use script.Parent.Parent.Parent.Parent.Parent.Parent. Use game.Players.LocalPlayer...