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

Crafting System appears for everyone?

I have made a simple crafting system, but there is one problem. When I hit the keybind, it opens the GUI for all the players online. I have searched everywhere for this slight bug but nothing comes up. Here's the current code I have.

game:GetService("UserInputService").InputBegan:connect(function(g, y)
	if g.KeyCode == Enum.KeyCode.E then
		if not script.Parent.Parent:IsA("StarterGui") then
			script.Parent.ScrollingFrame.Visible = not script.Parent.ScrollingFrame.Visible
		end
	end
end)

Does anyone have ideas?

Thanks in advance, Iplaydev

2 comments

0

That did not help.

1 answer

✓ Accepted answer

Find the user who pressed the key and search in their PlayerGui to change the Visibility of the frame.

That obviously won't work yet unless you find out which player pressed the key first.

Player = KeyPressedE.Name -- Find Player who pressed key (The KeyPressedE var won't work it's just an example)
-- Just a simple player variable, You will need to find out the name of the player who pressed the key first

Frame = game.Players[Player].PlayerGui.ScreenGui.ScrollingFrame
-- Find the Frame of the player who pressed the key.

Frame.Visible = not Frame.Visible
-- Keeps you from writing out the same lines again and again.

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