You’re making something in the StarterGui visible and not something in the PlayerGui. StarterGui is on the server and it won’t replicate to the client. You need to fire a remote event to the client and in the client you would make the frame visible.
-- Server Script
remoteEvent:FireClient(player)
-- Local script
local frame = script.Parent.Frame
remoteEvent.OnClientEvent:Connect(function()
frame.Visible = true
end)
First off, there is no property called Enabled on a frame. It’s called Visible not ‘Enabled’.
Create a remote event in replicated storage and add a variable to access it.
(Do this in your server script)
local remoteEvent = game:GetService('ReplicatedStorage').RemoteEvent
Inside your code you would do (replacing the line where you make the frame visible):
remoteEvent:FireClient(player)
This tells the server to update the player’s GUI, which we will do in a local script.
Now open up your local script and add the following:
local remoteEvent = game:GetService('ReplicatedStorage').RemoteEvent
local frame = script.Parent.Frame -- or wherever your frame is at
remoteEvent.OnClientEvent:Connect(function()
frame.Visible = true
end)
StarterGui is a container for holding interfaces that replicate to the client on respawn. It’s static. Regardless of whether its for the client or server, nothing there is visible. All seen Guis are from PlayerGui or an adornee to a supported location, such as the workspace.
Mhm, it’s still not working… Should I export it to a blank place and send the place to you guys to see if you can see what might not be working? @histo_rical@colbert2677@AdvancedDrone
No. I’m sure that it does work, your implementation is just faulty or misunderstood. What is the code and hierarchy of objects you’re working with? Scripting Support is for helping you learn, not spoonfeeding you code without explanation or place files.
Code inside part:
local remoteEvent = game:GetService(‘ReplicatedStorage’).RemoteEvent
local CLICK_BLOCK = script.Parent
local ITEM_ID = 2573844912
local player = game.Players:GetChildren()
local Click = Instance.new("ClickDetector",CLICK_BLOCK)
Click.MouseClick:connect(function()
if game:GetService("GamePassService"):PlayerHasPass(player, ITEM_ID) then
remoteEvent:FireClient(player)
else
game:GetService("MarketplaceService"):PromptPurchase(p,ITEM_ID)
end
Your method to work out the player isn’t accurate, you’re using a table value (game.Players:GetChildren()). You’ll need to figure out whose actually clicking it and make that value the player.
local remoteEvent = game:GetService(‘ReplicatedStorage’).RemoteEvent
local CLICK_BLOCK = script.Parent
local ITEM_ID = 2573844912
local Click = Instance.new("ClickDetector",CLICK_BLOCK)
Click.MouseClick:connect(function(player)
if game:GetService("GamePassService"):PlayerHasPass(player, ITEM_ID) then
remoteEvent:FireClient(player)
else
game:GetService("MarketplaceService"):PromptPurchase(p,ITEM_ID)
end
end)