Showing images with a script

I have two problems
But let me tell you what my game is about so you can understand it better
I’m working on a game that is very similar to the pick a side games in Roblox
That is, for example, two groups of players choose two different things based on their interests, then because of their opinions they have to kill everyone else
And the thing is that I want to show an image instead of text
But I don’t know exactly how to do this
The second problem is that I want to make it so that teammates can’t hurt each other and writing this script from scratch is a disaster. Does anyone know a free mod or an easy way? I wrote this system but only for

local opinionsModel = workspace:WaitForChild("Opinions")

local opinions1 = opinionsModel:WaitForChild("Opinions1"):WaitForChild("SurfaceGui"):WaitForChild("TextLabel")
local opinions2 = opinionsModel:WaitForChild("Opinions2"):WaitForChild("SurfaceGui"):WaitForChild("TextLabel")


local yellowPart = workspace:WaitForChild("YellowSpawn")
local redPart    = workspace:WaitForChild("RedSpawn")


--local opinions1 = game.Workspace.Opinions.Opinions1.SurfaceGui.TextLabel
--local opinions2 = game.Workspace.Opinions.Opinions2.SurfaceGui.TextLabel

--local yellowPart = workspace:WaitForChild("YellowSpawn")
--local redPart = workspace:WaitForChild("RedSpawn")


local Data = {
	Gamepasses = {"۲ برآبر پول", "ذخیره‌سآزی"},
	Fruits     = {"درآگون ترآیدنت", "درآگون هآرت"},
	Swords     = {"دآرک بلید", "کرسد دوآل کآتآنآ"},
	Abilities  = {"فلیم دآش", "وآیولت استرآیک"},
	Events     = {"دآبل آکس‌پی ویکند", "دآبل فروتس ویکند"},
	Quests     = {"دفیت دِ سی بیست", "کلیر دِ آندروآتر تمپل"},
	BossFights = {"مآگمآ لورد", "سی بیست"}
}

local categoryOrder = {"Swords", "Fruits", "Gamepasses", "Abilities", "Events", "Quests", "BossFights"}
local currentIndex = 1

local gameState = "showing" -- یا "fighting"

local teleportedPlayers = {}

local function showItemsFromCategory(label1, label2, categoryName)
	local category = Data[categoryName]
	if category then
		label1.Text = categoryName .. ":\n- " .. (category[1] or "None")
		label2.Text = categoryName .. ":\n- " .. (category[2] or "None")
	else
		label1.Text = "Not found."
		label2.Text = "Not found."
	end
end

local function clearLabels()
	opinions1.Text = ""
	opinions2.Text = ""
end

local function showNext()
	if gameState ~= "showing" then return end
	if currentIndex > #categoryOrder then currentIndex = 1 end
	showItemsFromCategory(opinions1, opinions2, categoryOrder[currentIndex])
	currentIndex = currentIndex + 1
end

local function teleportPlayers()
	teleportedPlayers = {}
	for _, player in ipairs(game.Players:GetPlayers()) do
		local char = player.Character
		local hrp  = char and char:FindFirstChild("HumanoidRootPart")
		local teamName = player.Team and player.Team.Name
		local spawnPart = (teamName == "Yellow" and yellowPart) or (teamName == "Red" and redPart)
		if hrp and spawnPart then
			
			char.PrimaryPart = hrp
			char:SetPrimaryPartCFrame(spawnPart.CFrame + Vector3.new(0, 3, 0))
			table.insert(teleportedPlayers, player)
		end
	end
end

local function killSurvivors()
	for _, player in ipairs(teleportedPlayers) do
		local humanoid = player.Character and player.Character:FindFirstChild("Humanoid")
		if humanoid and humanoid.Health > 0 then
			humanoid.Health = 0
			task.wait(0.1)
			local stats = player:FindFirstChild("leaderstats")
			if stats and stats:FindFirstChild("Win") then
				stats.Win.Value = stats.Win.Value + 1
			end
		end
	end
end

while true do
	gameState = "showing"
	showNext()
	wait(10)

	gameState = "fighting"
	clearLabels()
	teleportPlayers()

	wait(30)

	task.killSurvivors()

	wait(10)
end

1 Like

You would simply have a SurfaceGui with an ImageLabel inside of it, and you would just have to change the Image property of the ImageLabel to your desired image’s ImageId.


Before damaging the hit player, you would simply do something like this:

if plr.Team ~= target.Team then
    targetHumanoid:TakeDamage(damage)
end
2 Likes

But what about swords, magic, and other tools?

Same thing. You would simply check if they are on the same team and damage them accordingly.

Edit: So this logic should be used whenever you’re damaging a player

It got a bit complicated. Is there a free model that will working for everything?

I guess you could just search it up in the toolbox? You could search up something like “sword,” but I don’t see how one if statement is complicated. Perhaps you’re overthinking things?

What the AI ​​wrote for me was about 160 lines long and it didn’t even work very well. It’s great that you were able to fix it so easily. I’ll definitely test this and hope it works for all weapons.
Can I ask you another question?

1 Like

No problem! Please note that you do have to set the teams for the players in order for this to work.

Of course!

1 Like

I wrote a plugin about scripting, but not many people took it. It’s true that I got help from artificial intelligence. It’s not very powerful, but it does a lot of things. It’s actually a script analyzer. If you think it’s dangerous, you can check it yourself.

1 Like

Cool. I think it would be better if we switched to private messages for this. So what is your question (PM me)?

Nothing
use it if you want
tytuyrewerwgffgiuyytuiuy

1 Like

Tried it. Works pretty decently. The only caveat is that it seems like 90% of it was written by AI—not just

Still, it definitely beats manually looking for those minor inconveniences. I might use this plugin regularly.

1 Like

Yes, I used artificial intelligence, it has some problems, like reporting things that aren’t really a problem.
I need to fix them.
If there’s a problem, let me know so I can fix it.

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