if i had a module script
local WeaponData = {}
export type WeaponInfo = {["Damage"]: number}
WeaponData.Axe = {["Damage"] = 5}
WeaponData.Sword = {["Damage"] = 3}
return WeaponData
i can use the type WeaponInfo so i can know what “Properties” weapons have
local RS = game:GetService("ReplicatedStorage")
local WeaponData = require(RS.WeaponData)
type WeaponInfo = WeaponData.WeaponInfo
local function NewWeapon(WeaponInfo: WeaponInfo)
return WeaponInfo
end
local Axe = NewWeapon({["Damage"] = 3}) -- I know Weapons have a damage "property" because of the type WeaponInfo
4 Likes