If you want to use a working version in your game, take this model: Chat For GUI [GAMEPASS VERSION]
I want to show a UI element when the player chats something and owns a gamepass. I've tried this script but doesn't seem to work. (I put this in a LocalScript in StarterGui and Script in workspace/ServerScriptService) Here's what happens: Click Here My problem seems to be (and I've tried without gamepass code) the player.Chatted.
local MarketplaceService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")
local gamePassID = 9291233
local player = Players.LocalPlayer
local hasPass = false
hasPass = MarketplaceService:UserOwnsGamePassAsync(player.UserId, gamePassID)
game.Players.PlayerAdded:connect(function(plr)
plr.Chatted:connect(function(msg)
if msg == "#custom" then
if hasPass == false then
MarketplaceService:PromptGamePassPurchase(player , gamePassID)
else
script.Parent.Custom.CUSTOMIZE.Visible = not script.Parent.Custom.CUSTOMIZE.Visible
end
end
end)
end)
I also tried
script.Parent.Custom.CUSTOMIZE.Visible = true
Nothing seems to work

7 comments
please tell us what it's doing and what you want it to do. we cannot fix your script with just "i don't know how to fix it, help".
i want to show a ui element when the player chats something and owns a gamepass
what is it doing instead?
nothing
Here is what happens: https://streamable.com/3r8i1d
try "script.Parent.Custom.CUSTOMIZE.Visible = false"
y