✓ Accepted answer
Problem
I've caught 2 problems in your script.
- You made a typo.
- You parented the gui into "StarterGui" which is the gui which every player gets upon joining.
- You didn't even check if a player touches the brick instead of a normal part.
Solution
Just simply correct the worspace into workspace and try to get the player's PlayerGui
script.Parent.Touched:connect(function(part)
local parent = part.Parent
local player = game.Players:GetPlayerFromCharacter(parent)
if player then
local teleportgui = game.Workspace.TeleportGui:Clone()
teleportgui .Parent = player.PlayerGui
end
end)
A tip (not a robux tip lol)
No need for that, but you should make the script check if the player already has the gui which will avoid giving the player multiple guis or you should put a debounce. http://wiki.roblox.com/?title=Debounce
Here is the option with the gui checker:
script.Parent.Touched:connect(function(part)
local parent = part.Parent
local player = game.Players:GetPlayerFromCharacter(parent) check if the parent is a player character
if player then
if not player.PlayerGui:FindFirstChild("TeleportGui") then
local teleportgui = game.Workspace.TeleportGui:Clone()
teleportgui .Parent = player.PlayerGui
teleportgui.Name = "TeleportGui"
end
end
end)
Comment on this if your script still errors so i'll just check the script again just incase i made a mistake.
2 comments
There shouldn't be an error, to my knowledge. Also line 3..... Your copying to startergui which won't work, because the player must reset for it to appear, and it appears for all users too...
You're*