You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? For my Wood.Value to go up only when an axe is hitting the log
-
What is the issue? Currently working on a simulator game, I have a script so that the tree is hit when my Axe tool hits it, however another script hits the tree when the humanoid makes contact with the log to add to my WoodValue
-
What solutions have you tried so far? I’ve tried to find other results and tried myself, however as they’re 2 different scripts i am unsure on how to work with them.
Script 1
local z = script.Parent
local x = z.Log
local y = z.Leaves
local hits = 0
local hitsN = 3
x.Touched:connect(function(hit)
if hit.Parent.Name == "Axe" then
hits = hits + 1
if hits == hitsN then
hits = 0
end
end
end)
Script 2
local db = true
script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") ~= nil then
if db == true then
db = false
script.Parent.Transparency = 1
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
player.leaderstats.Wood.Value = player.leaderstats.Wood.Value + 1
script.Parent.Transparency = 1
wait (10)
db = true
script.Parent.Transparency = 0
end
end
end)
Would really appreciate support on this, I’ll make sure to review the recommendations. I’m not a skilled scripter, as you can see my title is Artist, however I am exploring other areas and I recently have been getting hooked into scripting.