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

How can i make this spawn into to the player gui???

I want to make a screen gui clone into the player's gui, but it wont clone. Why is this happening? This script is in a part named Backwall1 and the code is in a local script.

local plr = game.Players.LocalPlayer
script.Parent.Touched:connect(function()
	local help = game.ReplicatedStorage:WaitForChild("Intro")
	help:Clone().Parent = plr.PlayerGui
end)

1 answer

Your problem is simple: You're trying to put a LocalScript in a brick.

http://wiki.roblox.com/index.php?title=API:Class/LocalScript

A localscript only works in the locations established in that wiki page.

For a possible solution, you could try using a normal script, like so:

script.Parent.Touched:connect(function(toucher)
	local plr = game:GetService("Players"):GetPlayerFromCharacter(toucher.Parent) or game:GetService("Players"):GetPlayerFromCharacter(toucher.Parent.Parent)
	if plr then
		local help = game:GetService("ReplicatedStorage"):WaitForChild("Intro")
		help:Clone().Parent = plr.PlayerGui
	end
end)

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