So I am working on a simulator game but have gotten stuck trying to write a script for cloning a particular weapon stored in ReplicatedStorage to the player's Backpack when their Strength reaches or goes above a specific value.
I am still learning so any help is greatly appreciated thanks!
/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
Edit: Okay, so I managed to get something to work.
Here's an example:
local tool = game.ReplicatedStorage.Weapons.AduriteKatana
local player = game.Players.LocalPlayer
local strength = player.leaderstats.Strength
local strengthneeded = 10
strength.Changed:Connect(function()
if strength.Value >= strengthneeded then
tool:Clone().Parent = player.Backpack
end
end)
It's very basic but at least it works right?
However, this means that whenever someone gains more strength, as long as they stay above 10, it'll keep cloning the weapon.
Edit2: I seem to have found a sort of fix for this. See example:
local weapons = game.ReplicatedStorage.Weapons
local toola = weapons.AduriteKatana
local toolb = weapons.BaconDagger
local player = game.Players.LocalPlayer
local strength = player.leaderstats.Strength
local a,b = 10,50
local has_toola = false
strength.Changed:Connect(function()
if strength.Value >= a and not has_toola then
toola:Clone().Parent = player.Backpack
has_toola = true
return
end
end)
local has_toolb = false
strength.Changed:Connect(function()
if strength.Value >= b and not has_toolb then
toolb:Clone().Parent = player.Backpack
has_toolb = true
return
end
end)
And here's my last and final question (I promise :) )
So I have to add each weapon manually one by one. I have over 74 weapons lol (secretly crying) Does anyone know of a better method? Or is this just gonna be a long day.
Thanks!

3 comments
Try reading this. If your new. https://developer.roblox.com/api-reference/function/Instance/Clone
its not exploitable to my knowledge,ive ddone some of that scripting to know whats possible and when you exploit you cant get something from the replicatedstorage unless there is a server script that connects the local script to the replicatedstorage
Ah okay I'm glad, thanks!