Can anyone tell me what’s the problem? I’m trying to make when I enter the zone, a textlabel comes to the screen and hops off when I exit the zone.
I managed to make it appear when being in the zone but I couldn’t figure out how to make it disappear when exiting the zone, I’ve tried TouchEnded but it thinks that I’m no longer in the zone so it disappears directly after I stay on the zone.
NOTE: The zone is a union
local debounce = true
local brick = game.Workspace.Safezonemodel.Union
brick.Touched:Connect(function(hit)
if hit and hit.Parent:FindFirstChild("Humanoid") and debounce == true then
local object = script.Parent
object.Position = UDim2.new(0.184, 0, 1, 0)
object:TweenPosition(UDim2.new(0.184, 0,0.8, 0))
debounce = false
if hit.Parent:FindFirstChild("Humanoid") == nil and debounce == false then
local object = script.Parent
object.Position = UDim2.new(0.184, 0, 0.8, 0)
object:TweenPosition(UDim2.new(0.184, 0, 1, 0))
debounce = true
end
end
end)
I’ve tried ZonePlus but when I walk randomly on the zone, it randomly executes the zone.playerexited, and then the zone. zone.playerentered come back. But all I did was I stayed in the zone
local Zone = require(game:GetService("ReplicatedStorage").Zone)
local container = workspace.Safezonemodel.Union
local zone = Zone.new(container)
zone.playerEntered:Connect(function(player)
local object = script.Parent
object.Position = UDim2.new(0.184, 0, 1, 0)
object:TweenPosition(UDim2.new(0.184, 0,0.8, 0))
end)
zone.playerExited:Connect(function(player)
local object = script.Parent
object.Position = UDim2.new(0.184, 0, 0.8, 0)
object:TweenPosition(UDim2.new(0.184, 0, 1, 0))
end)
I really do not understand what’s going on, if there’s anyone to help me, I would be grateful!