Hey there, I Am Trying to Call a function When a tool Is Activated By Such A Script.
local Tool = script.Parent
function onTouch(OtherPart)
local HumanOther = OtherPart.Parent:FindFirstChild("Humanoid")
if not HumanOther then return end
if HumanOther.Parent == Tool then return end
if HumanOther:FindFirstChild("NotToDamage") then print("Not To Damage") return end
print("Damaging")
HumanOther:TakeDmg(8)
end
local function Slash()
print("Activated")
local String = Instance.new("StringValue")
String.Parent = Tool
String.Name = "toolanim"
String.Value = "Slash"
end
Tool.Activated:Connect(Slash)
Tool.Handle.Touched:Connect(onTouch)
The Script is Placed Inside the Tool And The Above Script ONLY Works if I Put the Tool into Starter Pack.
If i Put the Tool into Starter Pack and Play the Game, I Get the Tool and It Prints Activated in the Output. But If i Clone the Tool from A Place (Such as Replicated Storage) to the Player’s Backpack, The Tool Does Not Work.
The Script is A SCRIPT And Not A Local Script