Why does my code not impact the module script?

Hello I meet a big problem on my game, if the player has the gamePass (“Wings”) then his returns (in the moduke) the value Obtained in real except that in the client, it does not update, I try RunService but I do not know if it is really his

image
image

--My module script "ManageItem"
local Item = {}
Item.__index = Item

function Item.new(name: string, accessory: Accessory, description: string, gamePassId: number)
	local newItem = {}
	setmetatable(newItem, Item)
	newItem.Name = name
	newItem.Accessory = accessory
	newItem.Description = description
	newItem.GamePassId = gamePassId
	newItem.Obtained = false
	return newItem
end 

function Item:CanEquipe(informationFrame)
	print(self.Obtained)
	if self.Obtained == true then
		informationFrame:Destroy()
	end
end

return Item

--My module "Item"
local manageItem = require(game.ReplicatedStorage.ManageItem)
local itemClone = game.ReplicatedStorage.ItemClone

local allItems = {
	["Wings"] = manageItem.new("Wings", itemClone.Wings:Clone(), "Wings gives you a bonus of +10% speed", 717071337)
}

return allItems
--Module "ManageUi"
local RunService = game:GetService("RunService")
local TweenService = game:GetService("TweenService")

local ManageUi = {}

function ManageUi:FrameScrolling(scrollingFrame, item, frameInfo)
	local camera = Instance.new("Camera")
	local accessoryClone = item.Accessory
	local handle = accessoryClone:FindFirstChild("Handle")
	local informationFrame = frameInfo:FindFirstChild("InformationFrame")
	frameInfo.Parent = scrollingFrame
	handle.Parent = frameInfo
	camera.Parent = frameInfo
	frameInfo.CurrentCamera = camera
	RunService.Heartbeat:Connect(function()
		item:CanEquipe(informationFrame)
	end)
	camera.CFrame = CFrame.new(0.05, 0, 7) * CFrame.Angles(0, 0, 0)
	TweenService:Create(handle, TweenInfo.new(5, Enum.EasingStyle.Linear, Enum.EasingDirection.In, -1), {Orientation = Vector3.new(0, 360, 0)}):Play()
	frameInfo.NameText.Text = item.Name
	frameInfo.Description.Text = item.Description
end

return ManageUi

-- Script "GamePasses"
local MarketplaceService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")
local manageItem = require(game.ReplicatedStorage.ManageItem.Item)

Players.PlayerAdded:Connect(function(player)
	for  _, item in manageItem do
		if MarketplaceService:UserOwnsGamePassAsync(player.UserId, item.GamePassId) then
			print("a")
			item.Obtained = true
		end
	end
end)

2 Likes

This should go in #help-and-feedback:scripting-support not here

3 Likes