How can I get GUI's to appear in certain areas

Hello! I am trying to figure out how I can make my Money GUI Change when you go into a different area. Such as when you go to a different zone, the Money GUI Changes to a different Money GUI, for lets say Snow Coins, when you go into the Snow World. How can I do this?

If you need more explanation, please ask!


If you also know how to do it with ZonePlus with a very good explanation, that would also be really helpful!

2 Likes
local players = game:GetService("Players")

players.PlayerAdded:Connect(function(player)
	local world = Instance.new("StringValue")
	world.Name = "World"
	world.Value = "Snow" --some world
	world.Parent = player
	if player:WaitForChild("World").Value == "Snow" then
		player:WaitForChild("PlayerGui"):WaitForChild("ScreenGui"):WaitForChild("Frame"):WaitForChild("ImageLabel").Image = "" --some image
	end
end)

Primitive, but this is essentially what you’d do.

1 Like

Where do I put where? What do I call World, what so I call Snow, etc

World is just a sample string value instance parented to the player, you would need to change it every time the player enters a new world, to that world, by doing.

player:WaitForChild("World").Value == "worldName"

Can you give an example on what 2 Areas would look like on the script? Also do I need to put anything in workspace, and call it something. Where do I also put the script? Would it be a script, or a localscript?

local players = game:GetService("Players")

players.PlayerAdded:Connect(function(player)
	local world = Instance.new("StringValue")
	world.Name = "World"
	world.Value = "Tutorial" --default world is tutorial mode
	world.Parent = player
	player.CharacterAdded:Connect(function(character)
		local playerWorld = player:WaitForChild("World")
		if playerWorld.Value == "Tutorial" then
			player:WaitForChild("PlayerGui"):WaitForChild("ScreenGui"):WaitForChild("Frame"):WaitForChild("ImageLabel").Image = "" --some image
		elseif playerWorld.Value == "Snow" then
			player:WaitForChild("PlayerGui"):WaitForChild("ScreenGui"):WaitForChild("Frame"):WaitForChild("ImageLabel").Image = "" --some image
		end
	end)
end)

This won’t work as it only works upon the player joins the game.

I will assume different currencies in your game has the same layout as other currency GUIs, you could just modify their property.

It’s under the CharacterAdded event, and it’s just an example, you could obviously easily move it if necessary. Without knowing how he intends to have players “change” worlds, I can’t implement it for that.

I do not see that event inside the PlayerAdded event.

Well I was going to do they touch a Part, and the GUI changes

Perhaps look at replies before replying yourself.

And perhaps you should edit the post instead of posting a new one.

Yes they have the same layout, but what you do mean by changing their property? What I mean is how can I get it to change its property by apon entering a part

Why? He asked for how to make it work for 2 or more worlds, so I did. No need to edit the old post, when making a new one makes just as much sense, on the other hand you replying before reading the replies does not make much sense.

1 Like

How can I get it so apon entering a area it shows up? Also where do I put this code. Is it a Script, or a localscript? Again, do I also put anything inside Workspace?

You could detect a player entering a certain area using Region3 functions (which are deprecated) or use workspace functions.

To modify the GUI property, let’s say both currency GUI has a name that indicates the currency type like Snow, Coins right? Let’s say you are having the TextLabel as Coins, and when the player enters another region(snowy region), you could make the TextLabel to display Snow instead.

local players = game:GetService("Players")
local snowWorldPart = workspace:WaitForChild("SnowWorldPart")

players.PlayerAdded:Connect(function(player)
	local world = Instance.new("StringValue")
	world.Name = "World"
	world.Value = "Tutorial" --default world is tutorial mode
	world.Parent = player
	player.CharacterAdded:Connect(function(character)
		local playerWorld = player:WaitForChild("World")
		if playerWorld.Value == "Tutorial" then
			player:WaitForChild("PlayerGui"):WaitForChild("ScreenGui"):WaitForChild("Frame"):WaitForChild("ImageLabel").Image = "" --some image
		elseif playerWorld.Value == "Snow" then
			
		end
	end)
end)

snowWorldPart.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("HumanoidRootPart") then
		local player = players:GetPlayerFromCharacter(hit.Parent)
		local worldStat = player:WaitForChild("World")
		worldStat.Value = "Snow"
		player:WaitForChild("PlayerGui"):WaitForChild("ScreenGui"):WaitForChild("Frame"):WaitForChild("ImageLabel").Image = ""
	end
end)

Here you go, changes on touching a part. This is a server script.

Where do I put the script? Is it a LocalScript, or a Script

But you actually need the correct parts & Gui instances as seen in the script.