I'm sorry, this is probably an extremely basic question, but I use the code below with anything else and it works fine, but when i replace what it does with the GUI things, it stops working. Why does this happen?
Noobley = game.StarterGui.ScreenGui.DialogueGUI.Noobley.Text.Double nExplain = game.StarterGui.ScreenGui.DialogueGUI.Noobley.Text.Double Double = game.StarterGui.ScreenGui.DialogueGUI.Noobley.Portraits.nExplain Next = game.StarterGui.ScreenGui.DialogueGUI.Next Name = game.StarterGui.ScreenGui.DialogueGUI.Name Text = game.StarterGui.ScreenGui.DialogueGUI.Text function onTouched(hit) Noobley.Visible = true --The name nExplain.Visible = true --The portrait Double.Visible = true --The text Next.Visible = true --The next button Name.Visible = true --The name box Text.Visible = true --The text box end script.Parent.Touched:connect(onTouched)
@Zenith_Lord is this how I'm supposed to do it? also should i put the part and the gui in the brick?
Text = script.Parent.Text function onTouched(hit) -- A few safety checks if hit and hit.Parent then local plr = game.Players:GetPlayerFromCharacter(hit.Parent) if plr then Text.Parent = plr.PlayerGui -- Whatever other guis you have, parent them to the plr's PlayerGui end end end script.Parent.Touched:Connect(onTouched)
Put the guis inside the player's PlayerGui. I also indented everything properly:
--[[ ... (guis here) ]] function onTouched(hit) -- A few safety checks if hit and hit.Parent then local plr = game.Players:GetPlayerFromCharacter(hit.Parent) if plr then Noobley.Parent = plr.PlayerGui nExplain.Parent = plr.PlayerGui -- Whatever other guis you have, parent them to the plr's PlayerGui end end end script.Parent.Touched:Connect(onTouched)