I made a basic system where it checks for the name of the tool that the player is holding. If they are holding a tool named Basic then it will give them 1, if they are holding a tool named Advanced then it will give them 5. You can add more items to ToolList by following the same format that Ive done.
local ToolList = {
{
ToolName = "Basic",
GiveAmount = 1
},
{
ToolName = "Advanced",
GiveAmount = 5
}
}
function GiveStats(player)
if player and player.Character then
local EquippedTool = player.Character:FindFirstChildOfClass("Tool")
if EquippedTool then
for index, Tool in pairs(ToolList) do
if Tool.ToolName == EquippedTool.Name then
return Tool.GiveAmount
end
end
end
end
return 0
end
local remote = game:GetService("ReplicatedStorage").Give
remote.OnServerEvent:Connect(function(Player)
Player.leaderstats.Sips.Value = Player.leaderstats.Sips.Value + GiveStats(plr)
end)
3 comments
Thank you so much but I just leave the script in workSpace?
Workspace or replicatedstorage, pretty much anywhere is good
Hey I need you help the script did not work I added an tool Called Basic and when I clicked I got nothing. Please reply. @thatwalmartman