Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I make a Pop Up Gui when touched a invisible part?

Asked by 4 years ago

I want to make Pop Up's by a gui to represent my character thinking. How may I do this local? Like only the person who touched the part only sees it ?

0
You use a local script... Thesquid13 301 — 4y
0
In a local script you can run a touch function, when it activates create one of those 3D Gui's RealTinCan 217 — 4y

1 answer

Log in to vote
0
Answered by
noammao 294 Moderation Voter
4 years ago
Edited 4 years ago

There are a lot of different ways to make a GUI appear. You can use RemoteEvents or server scripts. But the simplest way would be through local scripts. But, if you want the GUI to pop up whenever you touch a part in the workspace you can't use a local script since it doesn't run there. What you could do instead is to make a server script that communicates with the local script through RemoteEvents whenever the part get's touched. Also, just to respond to the title, it doesn't matter if a part is invisible or if the CanCollide is set to false. The Touched event will still fire.

Now, I'm assuming that when you ask about "how to make it local" you mean that only one player (the player) that touches the part sees the GUI. A way to do this would be by getting the name of the model (Characters name) and then either using an In pairs loop or using the GetPlayerFromCharacter function.

To get to the point here is what it could look like:

local ScreenGui = Instance.new("ScreenGui")
local Frame = Instance.new("Frame")
Frame.Size = UDim2.new(1,0,1,0)
Frame.Parent = ScreenGui

script.Parent.Touched:Connect(function(part)
    if part.Parent:FindFirstChild("HumanoidRootPart") then -- If the model contains a HumanoidRootPart then continue.
        local Character = part.Parent -- The parent of the part that touched the object.
        local Player = game.Players:GetPlayerFromCharacter(Character) -- Getting the player.
        ScreenGui.Parent = Player:WaitForChild("PlayerGui") -- Setting the parent of the GUI to your PlayerGui so that it only shows up for you.
    end
end)
0
If anything i've written is incorrect or inaccurate please comment. I don't want to spread misinformation. noammao 294 — 4y
0
Thanks! The script works perfectly! I just kinda modified it a bit so it matches the color etc. RedzibiTV 4 — 4y
Ad

Answer this question