But from what im understanding i can not use local player inside module scripts so i wanted to create a folder in replicated storage thats the same name as the player and put the value in there instead. Im just not sure how id find the folder and only the folder thats the same name as the player
You can use LocalPlayer in ModuleScripts when the ModuleScripts are required by a LocalScript.
You can use FindFirstChild to find things by string value, or you can use square brackets if you know it exists: parentFolder[playerName]
The thing I can think of logically is you want like there’s a folder in ReplicatedStorage and there are folders for each players in the game and you want to add a value to their folders using ModuleScripts but you are confused on how to get LocalPlayer in ModuleScripts
You should probably add a parameter to your function in your modulescript named player and return the player, and after accessing it from local script, set the player parameter to local player, then change the name of your folder to player’s name
And you’re not requiring the ModuleScript in a regular Script? If the exact error was attempt to index nil with Value1 on that line, then I can’t see any reason why that particular line wouldn’t work.
This is the way i had my module script atm and it works. But the value inside the player doesnt change. And even if the player doesnt own the gampass itll still give a true value for the shop to show that specific item
local Players = game:GetService("Players")
local MarketplaceService = game:GetService("MarketplaceService")
local function Even(player)
if MarketplaceService:UserOwnsGamePassAsync(player.UserId,24648574) then
local Even = player.Even
Even.Value = true
else
Even.Value = false
end
end
local TowerShop = {
["Test1"] = {
["Name"] = "Test",
["ImageAsset"] = "rbxassetid://" ,
["Price"] = 0,
["Description"] = "Blank",
["Event"] = Even,
}
}
return TowerShop
Hmmm…It seems like you want to literally ignore me just because my avatar is bacon, if you think like that, only if you do, then let me tell that this is my alt, my main is @RobloxMastersTeam1, but anyways good luck, I hope you get answers, I won’t post anything because who cares
Im not ignoring you. I was just about to ask where would i put return. Was trying what you said in the beginning but couldnt get it to work. And what do you mean by assigning a value to “Event”? Event should be the value of Even
I mean that in the even function, you made a variable called Even, but you forgot to return the Even variable. Just for you to understand what I mean, I said that you need to return a “variable”, but it’s like you returned the value you want to get from a function. Basically, return means like you have a weighing machine, you put something in it to weigh, and it shows the weight i.e the value, so it returns a value
I put the return and it still does the same thing. shows up even tho the Even value in the player is false. But even if i own the gamepass it still shows up false