I am creating a message that displays the region you are in when entering a part zone. However, whenever you enter the zone, the GUI will not tween at all, it will disappear for a set amount of time, and come back fully sized as intended.
-- Zone Controller
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Zone = require(ReplicatedStorage.Zone)
local ZoneController = require(ReplicatedStorage.Zone.ZoneController)
-- Containers
local AncestorContainer = workspace.EnvironmentTriggers -- Makes up all the regions within the folder
-- Zone Variables
local ZoneVar = Zone.new(AncestorContainer)
local localPlayer = game.Players.LocalPlayer
local playerGui = localPlayer:WaitForChild("PlayerGui")
ZoneVar.playerEntered:Connect(function(playerWhoEntered) -- Fire script when they enter
playerGui.RegionGUI.Background:TweenSize(
UDim2.new(0.4,0, 0.15,0), --The Size it will be
Enum.EasingDirection.Out, --The Easing Direction
Enum.EasingStyle.Cubic, -- The Easing Style
2, --How long it takes to complete
true -- Override any other tweens in progress
)
end)
ZoneVar.playerExited:Connect(function(playerWhoExited) -- Fire script when they exit
print("exited")
end)