Hello! I am just wondering why my bindable event is not firing from my module script and a better alternative.
Module:
local damage = {}
function damage.Damage(plr,enemy,damage)
if enemy then
local hum = enemy:FindFirstChildOfClass("Humanoid")
print( enemy.Name)
hum:TakeDamage(damage)
if hum.Health <= 0 then
for i, lootValue in ipairs(enemy.Loot:GetChildren()) do
for j=1,lootValue.Value do
print(lootValue.Name)
game:GetService("ReplicatedStorage").Bindables.Give:Fire(plr,lootValue.Name)
end
game:GetService("ReplicatedStorage").Events.SystemAnnouncement:FireClient(plr,tostring("You obtained "..lootValue.Value.." "..lootValue.Name.."!"),Color3.new(1,0,0))
end
end
else
warn("No sent enemy or is nil.")
end
end
return damage
Server Script:
local function GiveItem(plr,itemName)
local inventory = plr:WaitForChild("InventoryF")
local item = ReplicatedStorage.Items:FindFirstChild(itemName):Clone()
print("Executed")
if item then
item.Parent = inventory
SaveData(plr)
else
warn("Expected item, got nil.")
return
end
end
I don’t see “Executed” in the output.