#PopUpGui
55 messages · Page 1 of 1 (latest)
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
Still, it seems you never actually put the GUI in the players PlayerGui
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
so should i clone it into game.Players.LocalPlayer.PlayerGui ?
im actually new to roblox api so...
yeah
then make the clone visible
and should i make the clone visible witha true statement or its gonna be visible automatically?
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
gui:Clone()
but how can i add the game.Players.LocalPlayer.PlayerGui
local clone = gui:Clone()
clone.Parent = game.Players.LocalPlayer.PlayerGui
like this?
** You are now Level 1! **
yeah
still nothing xd
and?
You didn't even do anything with the clone
the gui is a ScreenGui right?
uh
make the clone a variable
local guiClone = gui:Clone()
guiClone.Enabled = true
guiClone.Parent = game.Players.LocalPlayer.PlayerGui
i figured it out
NO! Absolutely not! Move the GUI from Replicated Storage to StarterGui
But its actually not a required gui to start the game, its just when a player near a coordinate, its shows a gui which says press E
Just set enables on the gui to false