This is a module script located in replicated storage and is used to determine drop chances of cases
If the user owns a specific gamepass i want these values to be changed but it’s not working, any ideas??
local properties = {}
local gamepassId = 735558039
local ms = game:GetService("MarketplaceService")
print("Module script running")
local commonChance = 50
local uncommonChance = 25
local rareChance = 15
local epicChance = 8
local legendaryChance = 3
-- Function to check if a player owns the gamepass
local function playerOwnsGamepass(player)
if player and player.UserId then
local success, hasPass = pcall(function()
return ms:UserOwnsGamePassAsync(player.UserId, gamepassId)
end)
return success and hasPass
end
print("Module script gamepass unowned")
return false
end
game.Players.PlayerAdded:Connect(function(player)
-- Check if the player owns the gamepass
if playerOwnsGamepass(player) then
commonChance = 40
uncommonChance = 20
rareChance = 25
epicChance = 15
legendaryChance = 7.5
else
print("User does not own specific gamepass and their chance won't be increased.")
end
end)
-- Default properties
properties["Items"] = {
"Burning Sensation", "Blue Ripples", "Endless Void", "Angel of Angels", "Pink Cyborg", "Orange Dash",
}
properties["Chances"] = {
Common = commonChance,
Uncommon = uncommonChance,
Rare = rareChance,
Epic = epicChance,
Legendary = legendaryChance,
}
properties["Price"] = 1000
properties["Image"] = "rbxassetid://16612003467"
return properties
true that’s why there no point in hiding the module script. Cause if the local script has to access it then the module has to be somewhere on client side.
Since it didn’t work for me, I’ve decided to do another approach.
Server Side Script:
local replicatedStorage = game:GetService("ReplicatedStorage")
local marketplaceService = game:GetService("MarketplaceService")
local drpChecker = replicatedStorage:WaitForChild("DropRateChecker")
local gamepassId = 735558039
local function calculateChances(player)
local commonChance, uncommonChance, rareChance, epicChance, legendaryChance
local owned = marketplaceService:UserOwnsGamePassAsync(player.UserId, gamepassId)
if owned then
commonChance = 40
uncommonChance = 20
rareChance = 25
epicChance = 15
legendaryChance = 7.5
else
commonChance = 50
uncommonChance = 25
rareChance = 15
epicChance = 8
legendaryChance = 3
end
drpChecker:FireClient(player, commonChance, uncommonChance, rareChance, epicChance, legendaryChance)
end
game.Players.PlayerAdded:Connect(function(player)
calculateChances(player)
end)
for _, player in ipairs(game.Players:GetPlayers()) do
calculateChances(player)
end
Module Script
local properties = {}
local commonChance = nil
local uncommonChance = nil
local rareChance = nil
local epicChance = nil
local legendaryChance = nil
local loaded = false
local replicatedStorage = game:GetService("ReplicatedStorage")
local drpChecker = replicatedStorage:WaitForChild("DropRateChecker")
drpChecker.OnClientEvent:Connect(function(player, NewcommonChance, NewuncommonChance, NewrareChance, NewepicChance, NewlegendaryChance)
NewcommonChance = commonChance
NewuncommonChance = uncommonChance
NewrareChance = rareChance
NewepicChance = epicChance
NewlegendaryChance = legendaryChance
loaded = true
end)
properties["Items"] = {
"Burning Sensation", "Blue Ripples", "Endless Void", "Angel of Angels", "Pink Cyborg", "Orange Dash",
}
repeat
wait(1)
until loaded
properties["Chances"] = {
Common = commonChance,
Uncommon = uncommonChance,
Rare = rareChance,
Epic = epicChance,
Legendary = legendaryChance,
}
properties["Price"] = 1000
properties["Image"] = "rbxassetid://16612003467"
return properties
I recently started working with moules, so correct me if im wrong. In my knowledge, when server requires a module it gets a copy of everything the module have. SO whatever the changes the client will make, will not replicate on server side. So if the gamepass and changing values are getting handled on the server side then idts there anything to worry about. And if its done on the client side then yea its easy to hack.
I’m not an expert on the details. I just know I have read a lot and everything I have read says they can be hacked. What “hacked” means, I don’t know for sure.