#PopUpGui

55 messages · Page 1 of 1 (latest)

merry dust
#

So i was making a PopUpGui, when a players reaches a position, it sets its visibility on, but seems like it doesnt work... can someone help?

devout parrot
# merry dust

It seems you never actually put the GUI in the players PlayerGui

merry dust
# devout parrot It seems you never actually put the GUI in the players PlayerGui
local player = game:GetService("Players").LocalPlayer
local cpt = game.ReplicatedStorage.cp1
local gui = game.ReplicatedStorage:WaitForChild("PopUpGui")

local function checkForCollisions()
    local character = player.Character
    if not character then
        return
    end

    local humanoidRootPart = character.PrimaryPart
    if not humanoidRootPart then
        return
    end

    local cpName = game.Workspace.cp
    if not cpName then
        return
    end

    local part1 = cpName.PrimaryPart
    if not part1 then
        return
    end

    local humanoidPosition = humanoidRootPart.Position
    local partPosition = part1.Position

    -- Convert the positions to Vector2
    local humanoidPosition2D = Vector2.new(humanoidPosition.X, humanoidPosition.Z)
    local partPosition2D = Vector2.new(partPosition.X, partPosition.Z)

    local distance = (humanoidPosition2D - partPosition2D).Magnitude
    if distance <= 10 then
        print('Player is close to the part')
        gui.Enabled = true
        cpt:FireServer()
    end
end

while true do
    checkForCollisions()
    wait(0.1) -- Adjust the delay as needed
end
#

i made these changes

#

and still nothing

devout parrot
#

The UI is in replicated storage

#

you can clone it, move it, but you need to put the GUI in game.Players.LocalPlayer.PlayerGui for it to be visible to the player

merry dust
#

so should i clone it into game.Players.LocalPlayer.PlayerGui ?

merry dust
devout parrot
#

then make the clone visible

merry dust
#

and should i make the clone visible witha true statement or its gonna be visible automatically?

devout parrot
#

The clone will keep the properties of what you cloned

#

so if it wasn't visible when you cloned it

#

then it shouldn't be visible

merry dust
#

can you help me with the clone

#

like the line of code

devout parrot
#

gui:Clone()

merry dust
#

but how can i add the game.Players.LocalPlayer.PlayerGui

devout parrot
#

local clone = gui:Clone()
clone.Parent = game.Players.LocalPlayer.PlayerGui

merry dust
#

like this?

keen cobaltBOT
#

studio** You are now Level 1! **studio

devout parrot
#

yeah

merry dust
#

still nothing xd

devout parrot
#

uhm

#

you cloned it

#

er

merry dust
#

and?

devout parrot
#

You didn't even do anything with the clone

merry dust
#

ohh

#

umm

#

what should i?

devout parrot
#

the gui is a ScreenGui right?

merry dust
devout parrot
#

Uhm?

#

Is its class a ScreenGui

merry dust
#

it is, sorry

devout parrot
#

Okay

#

Use .Enabled then

merry dust
#

is it ok?

devout parrot
#

uh

#

make the clone a variable

#

local guiClone = gui:Clone()
guiClone.Enabled = true
guiClone.Parent = game.Players.LocalPlayer.PlayerGui

merry dust
#

still

#

nmothing xd

merry dust
#

i figured it out

distant beacon
merry dust
#

Mhmm

#

Okay

merry dust
distant beacon