this should help you get a general idea of what tagging is:
ok thank you (i had to extend the text)
Question, how will i find the tag if the rock isnt a humanoid.
you can parent the tag however you want. if thats what you’re referring to?
ok i looked at another dev forum and i get how to use a tag system now
also check this post he said he made a slight error in the earlier linked post:
so parent it then add it as a debris item (debris means it goes away and in the post its 2 seconds)
oh ok, i get it now. Thank you, imma try to add it now, now that i got a good idea of how to use it.
I tried my best, and now it wont give any xp at all now.
Is there a way i can get a local player from a server script or is that not possible in my case, imma try to use an event instead and see if that works.
how are you checking to damage a block then? There should be a parameter given.
I really don’t know, I’m incredibly confused at this point on what to do. and I’m starting to lose hope alittle.
ok i think i may found a solution, i might make a separate script within the rock that’s a local script, it’ll wait till the rock gets damage, if its health is below 0. It will call the event, and activate the function as well as find the local player
what? No your mining tool is damaging the block, there is a piece of code doing that for you
main problem is each rock waits till the pickaxe hits it and finds a value within the pickaxe called “damage” and minuses its health with the damage value.
Health = Health - Damage
the script within the pickaxe only manages its animations, as well its mining speed.
here’s what the pickaxe looks like
is the script local or server sided also this:
Rock.Health.Changed:Connect(function()
makes me think that it doesn’t rely on a remote event.
can you send me this code and also tell me if its server or local script
Here’s the image
Here’s the Rock’s Script
--Services
local ss = game:GetService("ServerStorage")
local sss = game:GetService("ServerScriptService")
--LootTable
local Common = 1000 --1
local Uncommon = 500 --2
local Rare = 200 --3
local UltraRare = 35 --4
local Legendary = 10 --5
local Mythic = 0.2 --6
local Drops = {
--Ores
--Common
{Name = "Coal"},
{Name = "Copper"},
{Name = "Iron"},
{Name = "Lead"},
{Name = "Tin"},
--Uncommon
{Name = "Amber"},
{Name = "Gold"},
{Name = "Platinum"},
{Name = "Sapphire"},
{Name = "Topaz"},
{Name = "Tungesten"},
--Rare
{Name = "Cobalt"},
{Name = "Diamond"},
{Name = "Emerald"},
{Name = "Garnet"},
{Name = "Onyx"},
{Name = "Ruby"},
{Name = "SkyBlueTopaz"},
--Crystals
--Uncommon
{Name = "Sapphire Crystal"},
{Name = "Rhodolite"},
{Name = "Amethyst Crystal"},
--Rare
{Name = "Clear Quartz"},
{Name = "Sky Blue Topaz"},
--UltraRare
{Name = "Amethyst Airs Quartz"},
{Name = "Crystallized Diamond"},
{Name = "Crystallized Emerald"},
{Name = "Black Kinitaenite"},
{Name = "Spessartite Garnet"},
--Legendary
{Name = "Enchanted Luzi"},
{Name = "Enchanted Rose Qaurtz"},
{Name = "Hallowed Crystal"},
}
local OreLootTable = {
--Common Drops
{Item = Drops[1], Weight = Common}, --Coal
{Item = Drops[2], Weight = Common}, --Copper
{Item = Drops[3], Weight = Common}, --Iron
{Item = Drops[4], Weight = Common}, --Lead
{Item = Drops[5], Weight = Common}, --Tin
--Uncommon Drops
{Item = Drops[6], Weight = Uncommon}, --Amber
{Item = Drops[7], Weight = Uncommon}, --Gold
{Item = Drops[8], Weight = Uncommon}, --Platinum
{Item = Drops[9], Weight = Uncommon}, --Sapphire
{Item = Drops[10], Weight = Uncommon}, --Topaz
{Item = Drops[11], Weight = Uncommon}, --Tungesten
--Rare Drops
{Item = Drops[12], Weight = Rare}, --Cobalt
{Item = Drops[13], Weight = Rare}, --Diamond
{Item = Drops[14], Weight = Rare}, --Emerald
{Item = Drops[15], Weight = Rare}, --Garnet
{Item = Drops[16], Weight = Rare}, --Onyx
{Item = Drops[17], Weight = Rare}, --Ruby
{Item = Drops[18], Weight = Rare}, --Sky Blue Topaz
}
local CrystalLootTable = {
--Uncommon Drops
{Item = Drops[19], Weight = Uncommon}, --Sapphire Crystal
{Item = Drops[20], Weight = Uncommon}, --Rhodolite
{Item = Drops[21], Weight = Uncommon}, --Amethyst Crystal
--Rare Drops
{Item = Drops[22], Weight = Rare}, --Clear Quartz
{Item = Drops[23], Weight = Rare}, --Sky Blue Topaz
}
for i,Rock in pairs((script.Parent:GetChildren())) do --Will Get all of the Rocks
if(Rock:IsA("BasePart")) then --Will Test if the Rock is a Part
if(Rock:FindFirstChild("Health"))then
local label = Rock.HealthInfo
local hit_sound = Rock.Parent.Hit
local rockPos = Rock.Position
local Health = Rock.Health
local MaxHealth = Rock.MaxHealth
local RockMined = Rock.Mined.Value
local debounce = false
--Mining Manager
Rock.Touched:Connect(function(otherPart)
local tool = otherPart.Parent
if tool:IsA('Tool') and tool.Mining.Value == true then
if debounce == false then
debounce = true
local damage = tool.Damage.Value
hit_sound:Play()
Health.Value = Health.Value - damage
label.TextLabel.Text = Health.Value.."/"..MaxHealth.Value
if Rock.Health.Value <= 0 then
if RockMined == false then
RockMined = true
local stone = ss.Drops.Normal:WaitForChild("Stone")
--Stone Generator
for i = 1, math.random(1,4) do --Grabs a random number between 1-4 and begins a loop
local clone = stone:Clone() --Clones the Stone 1-4 times
clone.Parent = workspace --The Cloned Stones appear in the Workspace
if clone:IsA("Model")then
clone.PrimaryPart.Position = rockPos --The Clones Stones will appear at the rock that was mined
elseif clone:IsA("BasePart")then
clone.Position = rockPos --The Clones Stones will appear at the rock that was mined
end
end
if Rock.Variety.Value == "Normal" then
local function returnSumOfWeight(OreLootTable)
local sum = 0
for _, entry in pairs(OreLootTable) do
sum = sum + entry.Weight
end
return sum
end
local function getRandomItem(OreLootTable)
local randomNumber = math.random(returnSumOfWeight(OreLootTable))
for _, entry in ipairs(OreLootTable) do
if randomNumber <= entry.Weight then
return entry.Item
else
randomNumber = randomNumber - entry.Weight
end
end
end
--Crystal/Ore Generator
local RandomItem = getRandomItem(OreLootTable)
local Item = ss.Drops.Ores:FindFirstChild(RandomItem.Name)
for i = 1, math.random(1,3) do --Grabs a random number between 1-3 and begins a loop
local clone = Item:Clone() --Clones the Ores/Crystals 1-3 times
clone.Parent = workspace --The Cloned Ores/Crystals appear in the Workspace
clone.Position = rockPos --The Clones Ores/Crystals will appear at the rock that was mined
end
elseif Rock.Variety.Value == "Crystal" then
local function returnSumOfWeight(CrystalLootTable)
local sum = 0
for _, entry in pairs(CrystalLootTable) do
sum = sum + entry.Weight
end
return sum
end
local function getRandomItem(CrystalLootTable)--Grabs a random Item from the crystal loot table
local randomNumber = math.random(returnSumOfWeight(CrystalLootTable))
for _, entry in ipairs(CrystalLootTable) do
if randomNumber <= entry.Weight then
return entry.Item
else
randomNumber = randomNumber - entry.Weight
end
end
end
--Crystal/Ore Generator
local RandomItem = getRandomItem(CrystalLootTable) --Grabs a random item from the table
local Item = ss.Drops.Crystals:FindFirstChild(RandomItem.Name) --Finds the random item from the table in ServerStorage
for i = 1, math.random(1,3) do --Grabs a random number between 1-3 and begins a loop
local clone = Item:Clone() --Clones the Ores/Crystals 1-3 times
clone.Parent = workspace --The Cloned Ores/Crystals appear in the Workspace
if clone:IsA("Model")then--Will test if the crystal is a model
clone.PrimaryPart.Position = rockPos --The Clones Ores/Crystals will appear at the rock that was mined
elseif clone:IsA("BasePart")then --Will test if the crystal is a part
clone.Position = rockPos --The Clones Ores/Crystals will appear at the rock that was mined
end
end
end
end
end
wait(0.05)
debounce = false
end
end
end)
Rock.ClickDetector.MouseHoverEnter:Connect(function(player)
game:GetService("ReplicatedStorage").RemoteFunctions.EnableGui:InvokeClient(player, Rock, true)
end)
Rock.ClickDetector.MouseHoverLeave:Connect(function(player)
game:GetService("ReplicatedStorage").RemoteFunctions.EnableGui:InvokeClient(player, Rock, false)
end)
Health:GetPropertyChangedSignal("Value"):Connect(function()
if (Health) then
label.TextLabel.Text = Health.Value.."/"..MaxHealth.Value
end
end)
label.TextLabel.Text = Health.Value.."/"..MaxHealth.Value
end
end
end
this is where you need to apply tag–this is just from a glance
where is the origin of health?
Health.Value = Health.Value - damage
The orgin of the health is in each seperate rock, mainly each one being an int value. Here is the picture of it.