Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why doesn't this make my TextLabel visible?

script.Parent.Touched:Connect(function(h)
	local hum = h.Parent:FindFirstChild("Humanoid")
	if hum ~= nil then
		h.Parent.HumanoidRootPart.CFrame = CFrame.new(workspace["Teleporter1part2"].Position)
	local Intro = game.StarterGui.Message.Introduction
       Intro.Visible = true
	
	
	end
end)

I wanted to make the brick teleport you and then make the text label so you can see it but is not working pls help. Also, this is a regular script, not a local script

2 answers

✓ Accepted answer

The StarterGui is not what the player sees. It is simply how the server knows what to put in each player's PlayerGui.

You're gonna have to do this:

local player = game:GetService("Players"):GetPlayerFromCharacter(h.Parent)
player.PlayerGui.Message.Introduction.Intro.Visible = true

3 comments

0

This didint work for me

0

Then you did it wrong.

0

Hit me up on discord for help mumble#0040

Please use a code block next time.

Regular Scripts cannot access the PlayerGui. To achieve what you are aiming for, you can use RemoteEvents.

First, lets set everything up.

Place a local script inside of the intro frame

Regular Script

local replicatedstorage = game:GetService("ReplicatedStorage")
local event = replicatedstorage:FindFirstChild("ServerGuiAccess")
local plrservice =  game:GetService("Players")

if not event then
	event = Instance.new("RemoteEvent")
	event.Name = "ServerGuiAccess"
	event.Parent = replicatedstorage
end

local debounce = false

script.Parent.Touched:Connect(function(hit)
	
	if debounce == true then return end

	local plr = plrservice:GetPlayerFromCharacter(hit.Parent)
	if not plr then return end

	local humanoid = plr.Character:FindFirstChildOfClass("Humanoid")
	if not humanoid then return end

	debounce = true

	local tele = game.Workspace:FindFirstChild("Teleporter1part2")
	plr.Character:MoveTo(tele.Position) --shorter way of teleporting character

	event:FireClient(plr) -- sends a signal to the client

	wait(1)

	debounce = false

end)

Local Script

local replicatedstorage = game:GetService("ReplicatedStorage")
local event = replicatedstorage:WaitForChild("ServerGuiAccess")

event.OnClientEvent:Connect(function()
	script.Parent.Visible = true
end)

I have just written this outside of studio, so there may be errors.

4 comments

0

This is actually false the server can access the PlayerGui, just not PlayerScripts as that is completely local.

0

Idk what a code block is xD

0

Don't take his advice, the server and regular scripts can access the PlayerGui just fine.

0

If the server could not access it, then StarterGui would break.

This discussion is preserved as it was. New answers, comments, and votes are closed.