I'm not very good at scripting, and I don't know much about it, and I don't know how to make a GUI. When I did this, I really took things I know and things I thought were going to work and made this:
function onTouch if game.Players onTouch function Display game.Workspace.ScreenGui end
I don't know if this script would display a ScreenGui when I touched the part. (This script is in the part I'm trying to use).
This script uses the Touched
event. Then used the GetPlayerFromCharacter
method to make sure that it is a player. Then I make sure the player does not have the gui already using FindFirstChild
. Then clone it into their PlayerGui
using the Clone
method.
Just add the path the the gui.
local Gui = Game:GerService("ServerStorage").??? script.Parent.Touched:connect(function(Part) local Player = Game.Players:GetPlayerFromCharacter(Part.Parent) if Player and not Player.PlayerGui:FindFirstChild(Gui.Name) then Gui:Clone().Parent = Player.PlayerGui end end)
function onTouch if game.Players onTouch function Display game.Workspace.ScreenGui end
I think you just made this up...
script.Parent.Touched:connect(function(p) if p~=nil and game:getService("Players"):getPlayerFromCharacter(p.Parent) then local me=game:getService("Players"):getPlayerFromCharacter(p.Parent) if me.PlayerGui:findFirstChild("Message")==nil then local msg=Instance.new("Message",me.PlayerGui) msg.Text="Text here" game:getService("Debris"):AddItem(msg,5) end end end)
This will give the player a simple message in the center of their screen for 5 seconds.
debounce = false script.Parent.Touched:connect(function(hit) local player = game.Players:GetPlayerFromCharacter(hit.Parent) if player and not debounce then debounce = true local gui = Instance.new('ScreenGui') gui.Parent = player.PlayerGui local frame = Instance.new('Frame') frame.Parent = gui frame.Size = UDim2.new(0, 50, 0, 50) debounce = false end end)
You can edit the GUI properties from there. Use this as a reference for the Frame properties:
http://wiki.roblox.com/index.php/RBX.lua.Frame_(Object)