How would i go about making a index like find the markers?

Hello.

recently, I’ve had an issue with making a badge-based index for my game, find the apples.

Im trying to make it to where if they own the badge, a green background will appear behind the apple they claimed. Example:

when owned:
owned

when not owned:

not owned

thats about it. If anyone can help me with this, i would be very grateful.
sorry if this is in the wrong category. If so, please correct me!

i do not have a current failed script, i got mad and deleted it after working with it for 2 hours, lol.

Pretty simple actually. First, have a table with all existing markers, have a function to load the markers GUI, loop through the markers in the table and create a frame in the GUI with the marker.

This is just some very basic explanation, if u have questions, LMK.

Could you dumb this down a bit, and maybe show a script example of what you mean? Im not a very good scripter and dont understand much of what you said.

you can do

local badge_service = game:GetService("BadgeService")

local badges = {
	[1] = {
		["name"] = "greenapple", -- marker name here
		['id'] = 2125216832 -- badge id here
	}
}

while true do
	for _, badge in ipairs(badges) do
		local name = badge.name
		local id = badge.id
		if badge_service:UserHasBadgeAsync(game.Players.LocalPlayer.UserId, id) then
			local ui = game.Players.LocalPlayer.PlayerGui.Markers:FindFirstChild(name) -- path to ui
			if ui then
				ui:FindFirstChild("owned").Visible = true 
			end
		end
	end

	task.wait(1)
end

Basically, add a new table for each badge with the badge id + the name of the ui image.

Ill try this out, thanks so much!

Question, where would i put the script?

a local script. But you’ll have to edit it to work. I’ve put comments on the parts u should edit

Ok, but i meant where in the explorer? for example, starterplayerscripts?

yes starterplayer scripts

1 Like

Oh ok, thank you! Ill see if this works.

There is an issue with it, it prints an error: Unable to cast Instance to int64 on line 14.

current code:

local badge_service = game:GetService("BadgeService")

local badges = {
	[1] = {
		["name"] = "greenapple", -- marker name here
		['id'] = 2125216832 -- badge id here
	}
}

while true do
	for _, badge in ipairs(badges) do
		local name = badge.name
		local id = badge.id
		if badge_service:UserHasBadgeAsync(game.Players.LocalPlayer, id) then
			local ui = game.Players.LocalPlayer.PlayerGui.Markers:FindFirstChild(name) -- path to ui
			if ui then
				ui:FindFirstChild("owned").Visible = true 
			end
		end
	end

	task.wait(1)
end

oh here

local badge_service = game:GetService("BadgeService")

local badges = {
	[1] = {
		["name"] = "greenapple", -- marker name here
		['id'] = 2125216832 -- badge id here
	}
}

while true do
	for _, badge in ipairs(badges) do
		local name = badge.name
		local id = badge.id
		if badge_service:UserHasBadgeAsync(game.Players.LocalPlayer.UserId, id) then
			local ui = game.Players.LocalPlayer.PlayerGui.Markers:FindFirstChild(name) -- path to ui
			if ui then
				ui:FindFirstChild("owned").Visible = true 
			end
		end
	end

	task.wait(1)
end

Woah! Exactly what i wanted, thank you so much!

Ive seen this before, yet for some reason it wouldnt fit with my ui. Like i could not edit it enough to get it to work. Thanks anyway.