Hey, there are folders inside player that have “enabled” and a “multiplier” value.
The folders are the players owned Weapons.
I want to make so when one is equipped more points can be earned with the multiplier or the weapon.
I couldn’t find A clear answer on how to make it like work in my game,
Basically I just wanna check if the value is true and if so it gets the multiplier value and multiplies the points.
Here is a example of the script:
local clickDetector = script.Parent
local Pointamount = --example value--
function onMouseClick(Player)
local getMultiplier
function getMultiplier(Player, Multiplier)
local Multi = 1
for i,v in pairs(Player.Boosts:GetChildren()) do
if v.Equipped.Value == true then
Multi = Multi + v[Multiplier].Value
-- I was not being too smart so I don't know where to add the lines where it adds the points and what would be the best way to multiply them?
-- I tried :"Player.leaderstats.Points.Value = Player.leaderstats.Points.Value + Pointamount * Multi"
end
end
return Multi
end
clickDetector.MouseClick:connect(onMouseClick)
Yeah, sorry If this is common sense because I am tired.
The Multiplying does not seem to work. Need help from smarter people.
If I read correctly you mean that when a player has a weapon equipped that weapon gives him a point multiplier.
If this is the case I would like to know if this script goes inside the tool, because the Equipped function i think does not work if it does not go inside the tool.
It’s really hard to follow what you’re trying to do. Could you post a screenshot of what the explorer tree looks like?
I think your example already shows getting the additive multiplier and I think you want to use it like this
local function give_reward(player: Player, reward: number)
local multi: number = getMultiplier(player, "childMultiplier")
local totalReward = reward * multi
player.leaderstats.experience_gold_whatever += totalReward
end
I think a good example of what I am kinda trying to achieve is like many “simulators” have like Pets or Boosts and when they are like equipped they give out a multiplier.
I think that If I had that I could customize it my way.