Issue with Gui Showing up on everyones screen

Where it says function sorry lol

LocalScripts run inside of PlayerGui/StarterGui, so no you shouldn’t need to move your script. Are you using the exact code in your original post inside the LocalScript because as far as I can see with the screenshot your code should work perfectly fine inside a LocalScript? Do you get any errors? Is any other code interacting with the shop gui?

I’ve created a local place file below with a working system that might help you. The code is located inside of the shop gui in StarterGui:

Shop prompt.rbxl (56.3 KB)

Code inside the place file:

local Prompt = workspace:WaitForChild("ShopBlock"):WaitForChild("ProximityPrompt")

local ShopFrame = script.Parent:WaitForChild("ShopFrame") -- Reference to the shop frame

-- Fire this to toggle the visibility of the shop gui. This function is here like this so that
-- both the close button and proximity prompt can connect to it. Saves writing the same code twice
local function toggleShopVisibility()
	if ShopFrame.Visible == false then
		ShopFrame.Visible = true
	else
		ShopFrame.Visible = false
	end
end

Prompt.Triggered:Connect(toggleShopVisibility) -- Connects the proximity prompt to the toggleShopVisibility() function
ShopFrame:WaitForChild("CloseButton").MouseButton1Click:Connect(toggleShopVisibility) -- connects the close button to the toggleShopVisibility() function

Edit:

@KingLegoTheMaker Edited code above to work with your references/paths:

local Prompt = workspace:WaitForChild("Shopblock"):WaitForChild("ProximityPrompt")

local ShopFrame = script.Parent:WaitForChild("Shop Frame")

local function toggleShopVisibility()
	if ShopFrame.Visible == false then
		ShopFrame.Visible = true
	else
		ShopFrame.Visible = false
	end
end

Prompt.Triggered:Connect(toggleShopVisibility)
1 Like

Youve been writing that for ages :sob:

Thank you, it works now but i am going to try it in game with other people. I had to change one reference in the script but it seems to be good

When i close it. i cant reopen

ill try it and see if that works

What do you mean by that when its done once it cant be done again?

Its ok @waterrunner fixed it and it works amazing

Now time to make player collisions off. Cant wait for the problems there :grin:. Thank you to everyone that helped me

Want me to give a script for disableing player collsions?

Lol if you can that would be very nice (last script i need to do for like a month)

This is from roblox documentation lol

local PhysicsService = game:GetService("PhysicsService")
local Players = game:GetService("Players")

PhysicsService:RegisterCollisionGroup("Characters")
PhysicsService:CollisionGroupSetCollidable("Characters", "Characters", false)

local function onDescendantAdded(descendant)
	-- Set collision group for any part descendant
	if descendant:IsA("BasePart") then
		descendant.CollisionGroup = "Characters"
	end
end

local function onCharacterAdded(character)
	-- Process existing and new descendants for physics setup
	for _, descendant in pairs(character:GetDescendants()) do
		onDescendantAdded(descendant)
	end
	character.DescendantAdded:Connect(onDescendantAdded)
end

Players.PlayerAdded:Connect(function(player)
	-- Detect when the player's character is added
	player.CharacterAdded:Connect(onCharacterAdded)
end)
1 Like

This has to be a server script in server script servikce

It worked. Thank you very much. That was my last script :partying_face:

Can you mark me as solution lol

I need to have more solved solutions lol.

Nvm yeah you cant make 2 solutions

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.