Why does this script not work for another baseplate?

i have 2 baseplates the first one works fine and there is a text label showing the value of the baseplate’s health using a numberValue and after the 1st baseplate’s health is = to 0 it doesn’t reset to the other baseplate’s value and doesn’t even function here is the script of the 2nd baseplate:

clicky = script.Parent
plate = clicky.Parent
plateHealth = plate.Health
txt = game.StarterGui.Value.TextLabel

clicky.MouseClick:Connect(function(Clicker)
	plateHealth.Value = plateHealth.Value - 5
	if plateHealth.Value <= 0 then
		plate.Anchored = false
		if workspace.Baseplate.Health.Value == 0 then
			txt.Text = "Baseplate Health:" .. tostring(plateHealth.Value)
		end
	end
end)

1st baseplate script:

clicky = script.Parent
plate = clicky.Parent
plateHealth = plate.Health
txt = game.StarterGui.Value.TextLabel
base2 = game.Workspace.Baseplate2
plateHealth2 = base2.Health

clicky.MouseClick:Connect(function(Clicker)
	plateHealth.Value = plateHealth.Value - 5
	if plateHealth.Value <= 0 then
		plate.Anchored = false
		print("Baseplate Destroyed Destroy Another One")
		clicky:Destroy()
		Clicker.Character:MoveTo(base2.Position, Vector3.new(-486.2,20, 512))
		txt.Text = "Baseplate Health:" .. tostring(plateHealth2.Value)
	end
end)
1 Like

Hello. Can you attach an image of the entire expanded explorer for both base plates? Thanks.

1 Like

here:
12

In the script, are you referencing the same text label for both baseplates? You may need to create separate ones for each. If this is true. when you click the second base plate, the health value of it should still be going down.

ye the same one i referenced in the scripts

Try instead creating two different ones with different names. And reference the first to the first base plate and the second to the second base plate.

1 Like

Also, I’d recommend CollectionService | Documentation - Roblox Creator Hub if you are going to have multiple of these baseplates. By using collection service, you only have to create one main script to maintain all of the baseplates. You can also create the text label in the one main script so you don’t have to create as many text labels as baseplates. A plugin that will help with collection service is this: Tag Editor Plugin.

1 Like

idk how to use them so i’d rather do the multiple texts one

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.