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?
Depends how you detect the new area, you could simply have the area be a big part, when the player colides with it (enters it) you will hide the coin gui, and make the snow coin gui visible.
There are videos for sure, but it’s quite simple so I can just show you here…
You would need each area to be covered in one huge part that is non-collidable and transparent so that it’s not in the way.
This example will show how to make it with two types of coins, but you can make any amount of different areas.
Put this into a local script in StarterPlayerScripts…
local areaPart --DEFINE IT TO THE PART THAT COVERS THE AREA
--Also define your gui objects for each coin (ex. i used "coinGui" and snowCoinGui" below)
function onTouched(touch, coinType)
if game.Players:GetPlayerFromCharacter(touch.Parent) then
if coinType = "normal" then
snowCoinGui.Visible = false
coinGui.Visible = true
elseif coinType = "snow" then
coinGui.Visible = false
snowCoinGui.Visible = true
end
end
end
normalAreaPart.Touched:connect(onTouched(touch, "normal"))
snowAreaPart.Touched:connect(onTouched(touch, "snow"))
Using the ZonePlus module you can just require it and then define the zone and use the modules simple functions.
Example:
local Zone = require(game.ReplicatedStorage.Zone)
-- Define Zone
local NewZone = Zone.new(game.Workspace:WaitForChild("ZoneBlock"))
--Set Zone Accuracy
NewZone:setAccuracy("High")
-- Set Zone Detection
NewZone:setDetection("Automatic")
-- On Player Enter
NewZone.playerEntered:Connect(function(player)
-- Player entered the zone
end)
-- On Player Exit
NewZone.playerExited:Connect(function(player)
-- Player exited the zone
end)
Alright so, for the script to work you need to define each area part, and each gui in the player’s StarterGui.
You would put the definitions that I’m showing below right before the “onTouched” function in the script.
You need to put the big parts around your areas into workspace and call them “Normal Area” and “Snow Area”, or put them anywhere you want but change the script below to find them, you do know how to simply get a part into a variable, right?
You would also need to create the two separate coin guis, each coinGui could be a frame, an image label, or whatever, depends on how you are making them. You would put the two coin guis into a ScreenGui that you put into StarterGui (check image below).
The local script on the image is where you would put the entire script.
local normalAreaPart = workspace:WaitForChild("Normal Area")
local snowAreaPart = workspace:WaitForChild("Snow Area")
local coinGui = script.Parent.coinGui
local snowCoinGui = script.Parent.snowCoinGui
Hey! Can you actually help me get this working? I am still not really sure how to this, and I am still REALLY confused. Like how am I supposed to do this?
local normalAreaPart = workspace:WaitForChild("Normal Area")
local snowAreaPart = workspace:WaitForChild("Snow Area")
local coinGui = script.Parent.coinGui
local snowCoinGui = script.Parent.snowCoinGui
local areaPart --DEFINE IT TO THE PART THAT COVERS THE AREA
--Also define your gui objects for each coin (ex. i used "coinGui" and snowCoinGui" below)
function onTouched(touch, coinType)
if game.Players:GetPlayerFromCharacter(touch.Parent) then
if coinType = "normal" then
snowCoinGui.Visible = false
coinGui.Visible = true
elseif coinType = "snow" then
coinGui.Visible = false
snowCoinGui.Visible = true
end
end
end
normalAreaPart.Touched:connect(onTouched(touch, "normal"))
snowAreaPart.Touched:connect(onTouched(touch, "snow"))
Hey! Can I get some more help on this? Like how can I add multiple worlds onto this? And what does “High” Mean, and 'Automatic"? How can I get it to open the frames/disable/enable them?