-
What do you want to achieve? I want to fix my script from being unable to access module script values
-
What is the issue? so I have a shop system where you purchase outfits and for some reason when I click purchase it sends the request to the server but when trying to index the values of that index it returns nil, I don’t know why It does that I’ll send screenshots and videos below
https://gyazo.com/bc16f730e67910912cba1367c065d4ce
this is the script that sends the requests (I’ll send part of it)
Clone.TextButton.MouseButton1Down:Connect(function()
print("Clicked")
if SkinInventory[i].Value == true then
print("Firing Server")
game.ReplicatedStorage.RequestEquipOutfit:FireServer(i)
else
print("Unowned")
game.ReplicatedStorage.RequestBuyOutfit:FireServer(i)
end
end)
i is the index of a module script which contains the following
and to the final part the server code
RequestBuyOutfit.OnServerEvent:Connect(function(plr,Outfit)
print("Requested Purchase")
print(Outfit.Name)
if Outfit.CostRobux == false then
print("CostRobux is false")
if plr.leaderstats.Cash.Value >= OutfitData[Outfit].NormalPrice then
plr.leaderstats.Cash.Value -= OutfitData[Outfit].NormalPrice
plr.ClothingHolder[Outfit].Value = true
print("Purchased Outfit!")
else
print("Not enough money??")
end
elseif Outfit.CostRobux == true then
print("Cost robux")
if Outfit.IsLimitedStock == true then
local Value
local success, err = pcall(function()
Value = SkinsDatastore:GetAsync(Outfit.."_Stock")
end)
while err do
wait(1)
print("error")
success,err = pcall(function()
Value = SkinsDatastore:GetAsync(Outfit.."_Stock")
end)
end
if Value > 0 then
MarketplaceService:PromptProductPurchase(plr,Outfit.DeveloperProductID)
end
else
MarketplaceService:PromptProductPurchase(plr,Outfit.DeveloperProductID)
end
end
end)
- What solutions have you tried so far? I tried searching in the dev forum and scripting helpers and none helped