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

Gui doesn't pop upon touch of brick?

script.Parent.Touched:Connect(function(HIT)
	local player = game.Players:GetPlayerFromCharacter(HIT.Parent)
	if player == game.Players.LocalPlayer then
		player.PlayerGui.ScreenGui.Shop.Visible = true
	end
end)

script.Parent.TouchEnded:Connect(function(HIT)
	local player = game.Players:GetPlayerFromCharacter(HIT.Parent)
	if player == game.Players.LocalPlayer then
		player.PlayerGui.ScreenGui.Shop.Visible = false
	end
end)

This is in a local script in a brick.

What is wrong here?

1 comment

0

I have had this problem before too. I just made it a regular script in StarterGui with a player variable and a click detector to make it open. Example:                                         local plr = script.Parent.Parent local click = game.Workspace.ATM.Open.ClickDetector

click.MouseClick:connect(function() plr.PlayerGui.ATM.Enabled = true

end)

1 answer

✓ Accepted answer

Never use local scripts in parts. Even when It comes to touch events. Use a Server Script (Regular Script) instead.

1 comment

0

Thank you! I'l remeber to keep that in mind form now on.

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