茶姐,问下单机版击杀怪物的武器会升级的代码和联机版有区别吗,自己不会写代码结构,想参考别人的,还有个, local function onkilledother(inst, data) local chance = 1 local victim = data.victim if victim.components.freezable or victim:HasTag("monster") then if math.random() < chance then if victim.components.lootdropper then victim.components.lootdropper:SpawnLootPrefab("redgem") end end end end 上面这段代码不能直接放进武器里嘛,增加击杀掉落的 inst:ListenForEvent("killed", onkilledother)